2009-08-28 8 views
5

私のシステムでは、railsのウェブサイトから登録しているユーザーです。私は、Rubyで書かれたカスタムアプリケーションサーバーからユーザーを認証する必要があります。authlogicでレールからユーザーを認証するにはどうすればよいですか?

エラーmesssage:

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

Railsの質問に正しくタグを付けてください。 –

答えて

5

最初にこれを試してみてください:

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

私は(それがなかったuser239662の答えからのアドバイスを使用して、このエラーを回避ましたしたがって、私はこのソリューションを投稿しています)。私のキュウリのステップ定義は次のようになります。

When /^I am logged in as "(.*)"$/ do |user| 
    @current_user = User.make!(:username => user) 
    require 'authlogic/test_case' 
    activate_authlogic 
    @current_session = UserSession.create!(@current_user) 
end 
関連する問題