rails g cancan:roles can generate roles and join table user_roles models" #578

wants to merge 2 commits into

4 participants


New generator added to create roles and join association user_roles migration and models and added association between them, run migration and provide ability to create three roles on the fly.


It'd be nice to be able to do rails g cancan:roles account incase the User model is something other than User like Account or something.


Check it now like by running

rails g cancan:roles account 
or this
rails g cancan:roles user
. Or any other model name related to authentication and need specific role to use cancan ability feature.


Awesome thanks!


@prakashsejwani The tests pass, but there is a lot of trailing white space. Can you clean that up and I'll verify again.


This is outside of the scope of CanCan. I am purposefully leaving CanCan decoupled from roles because I feel that is very app-specific. You may want to turn this into a separate gem and link from Roles wiki page

@ryanb ryanb closed this May 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment