开发者

Authlogic Rails 3

开发者 https://www.devze.com 2023-01-20 14:27 出处:网络
I am having a weird issue with Authlogic in Rails 3. I followed this how-to here but I get: NoMethodError in PeopleController#my

I am having a weird issue with Authlogic in Rails 3. I followed this how-to here but I get:

NoMethodError in PeopleController#my

undefined method `login_field' for Object:Class

app/controllers/application_controller.rb:33:in `current_session'
app/controllers/application_controller.rb:39:in `current_user'
app/controllers/application_controller.rb:44:in `require_user'

Any ideas how to get this 开发者_如何学运维fixed?


Can you post the relevant source? I think you made 2 mistakes

  1. You tried to configure acts_as_authentic options in people_controller.rb instead of in the model (presumably called app/models/people.rb in your code)
  2. You didn't wrap this code in the "acts_as_authentic" method block

Try this in app/models/people.rb

acts_as_authentic do |config|
    config.login_field = :email
end


Did you add the login field to the migration? You can remove it.

0

精彩评论

暂无评论...
验证码 换一张
取 消