开发者

Rails Roles / Permissions in a HABTM Relationship -- managing the relationship

I have created the following tables in my application - roles, permissions and permissions_roles. Roles HABTM permissions, and permissions HABTM roles. I have seen many tutorials on setting up all of the tables/models etc for the 3 tables and defining the relationship, but I haven't been able to find anything on actually maintaining the relationship -- What is the best practice -- set up a third controller/set of views?

I want to be able to create Roles/Permissions independently of the relationship, ie make the assignment later - If I create a new role, I may need to go back and assign existing permissions to it (or vice-versa).

I know there are plenty of plugins that do this sort of thing, but I really want 开发者_StackOverflow社区to see if I can learn more by starting from the ground up...

Thanks


Its a little bit dated, but should still work, I shudder at the verbosity of the code but it was one of the first things I did in Rails...

http://blog.wolfman.com/articles/2006/5/20/role-based-authentication-admin-page

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜