rolify: Method missing with Rails4.0rc + rolify
So using rolify 3.3.0.rc4 c8218ad. I was earlier running on 3.2 and decided to update the gem. Now I’m seeing;
rails4.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined local variable or method `scopify' for #<Class:0x007f933d2d0938> (NameError)
Heres Role.rb
class Role < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => :users_roles
belongs_to :resource, :polymorphic => true
scopify
end
Extending Role with Rolify seems to help though.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 24 (11 by maintainers)
I get the same issue with the react-rails gem but changing the order in the gemfile fixed the issue
If I read the The Rails Initialization Process doc correctly, Rails first use bundler in
config/boot.rbto setup load paths and then require railties and engines inapplication.rb.So basically, you should just need to add
gem "rolify"in yourGemfileand the magic happens. I don’t know what corner case you hit that prevents this normal behaviour. Add this to yourapplication.rbto force the railtie to load: