Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
240 views
in Technique[技术] by (71.8m points)

Authlogic Rails 3

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...