如何使用authlogic对rails中的用户进行身份验证?

air*_*iry 6 ruby authlogic

在我的系统中,用户通过rails网站注册.我必须使用ruby编写的自定义应用程序服务器对用户进行身份验证.

错误消息:

You must activate the Authlogic::Session::Base.controller with a controller object before creating objects (Authlogic::Session::Activation::NotActivatedError)
Run Code Online (Sandbox Code Playgroud)

小智 6

来自:http://rdoc.info/projects/binarylogic/authlogic

require "authlogic/test_case" # include at the top of test_helper.rb
setup :activate_authlogic # run before tests are executed
UserSession.create(users(:whomever)) # logs a user in
Run Code Online (Sandbox Code Playgroud)


epi*_*pid 5

先试试这个:

Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
Run Code Online (Sandbox Code Playgroud)