質問

When I use the following line in db/seed.rb:

 #Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
User.create!({:name => "debug", :email => "debug@deb.com", :password => "12345678", :password_confirmation => "12345678"})

I get:

    /authlogic-3.1.3/lib/authlogic/controller_adapters/abstract_adapter.rb:30:in `params': undefined method `params' for main:Object (NoMethodError)
        from /authlogic-3.1.3/lib/authlogic/session/params.rb:96:in `params_credentials'
        from /authlogic-3.1.3/lib/authlogic/session/params.rb:72:in `params_enabled?'
        from /authlogic-3.1.3/lib/authlogic/session/params.rb:66:in `persist_by_params'
[...]

I have the same error with this command in the console. Yet everything is fine in the application itself, i only have this issue in db/seed.rb or console.

The first commented line makes no difference (source http://www.tatvartha.com/2009/09/working-with-authlogic-in-scriptconsole/).

Ruby 1.9.3 Rails 3.2.8 Authlogic 3.1.3

役に立ちましたか?

解決

Auto-answer:

I had to remove the following from config/environment.rb:

Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top