NoamB / sorcery

Magical authentication for Rails 3 & 4
MIT License
2.31k stars 386 forks source link

generate user model missing include Sorcery::Model on mongoid #606

Open comme opened 10 years ago

comme commented 10 years ago

I use mongoid as my mongodb adapter and use sorcery do my user auth.After i execute:

rails generate sorcery:install

it's generate user.rb like this:

#app/model/user.rb
class User
  #include Sorcery::Model #missing include this model it will throw not found method `authenticates_with_sorcery!'                                                                                                                                                                                                
  authenticates_with_sorcery!
  include Mongoid::Document
end
arnvald commented 10 years ago

Hi @comme,

thanks for report. It's definitely a bug on our side. The lines order is wrong. First you need to call include Mongoid::Document and then call authenticates_with_sorcery!. Then it should work without the additional line.

comme commented 10 years ago

@arnvald thank you, it works!