Open vmcilwain opened 8 years ago
Just ran into this myself, it's seemingly undocumented outside of the linked PR but rails g rolify Role User engine
(note the engine
) should work. If you have Devise on that same model you also need to add devise
to the end of the argument list like rails g rolify Role User engine devise
@NuckChorris Would you like to add this to the wiki? I'm not sure what can be done in Rolify to fix this but at least we can document the solution. @EppO Any ideas of solutions?
If the generator doesn't work for you in an existing setup, here is the simple line to add to your user.rb
:
rolify :role_cname => 'MyEngine::Role'
Ruby: 2.2.2 Rails 4.2.4 Rolify 4.1.1
Hello, I am attempting to create an engine which needs to use a role system. I added rolify to my gemspec file; bundle installed and ran the generator.
There wasn't any documentation on how to run this via a generator so I ended up finding out on stack overflow that the following code should have worked:
However that does not seem to work. Digging around in the source a little bit I found the following commit that I think is supposed to fix this: https://github.com/RolifyCommunity/rolify/pull/243
But no matter what I try I get the following error: https://gist.github.com/vmcilwain/69952d9e64349b2b12a3
Any help is greatly appreciated.
Thanks