Search code examples
ruby-on-rails-3authlogicactivation

Authlogic activation problems


Sorry if this question was asked before but I got trouble with authlogic when I try to create UserSession instance in rails console like `UserSession.create! :login => 'blabla', :passw...' I get:

Authlogic::Session::Activation::NotActivatedError: You must activate the Authlogic::Session::Base.controller with a controller object before creating objects

Rails version: 3.0.4

Maybe I missed something? I'll be appreciated for any help :)


Solution

  • It seems you have to add somthing like

    Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
    

    into your config/environment.rb or somewhere.

    Hint taken from article Working with Authlogic in script/console