Reputation: 325
ok I'm using sorcery gem for the log in of the main engine. And I want to use it also in the main engine but whenever I call the user model in the mountable engine it says
undefined method `authenticates_with_sorcery!' for User:Class
When I said call it's like
@user = User.new
By the way I'm using mongoid 4.0.0 and rails 4.1
Upvotes: 2
Views: 420
Reputation: 325
As far as I remember when I posted this question sorcery gem doesn't support Mongoid 4 yet so they make a new branch in the github so that for those who are using Mongoid in that time can use sorcery with mongoid 4. Well basically the solution works for me is that I need to reference that branch in my Gemfile. I don't know right now if they already publish the latest sorcery gem.
Upvotes: 0
Reputation: 11631
In my case, the gems order in the gemfile was apparently wrong
Not good
gem 'sorcery'
gem 'mongoid'
Works!
gem 'mongoid'
gem 'sorcery'
Upvotes: 0
Reputation: 11
I ran into similar issues using MongoMapper. Try making sure that authenticates_with_sorcery!
appears beneath any of your database-related includes. For example:
class User
include Mongoid::Document
authenticates_with_sorcery!
end
Upvotes: 1