昏迷使用authlogic

时间:2009-10-14 12:39:09

标签: ruby-on-rails content-management-system authlogic blogs

我开始使用昏迷来处理我网站上的内容,但在使用通用Authlogic配置进行现有身份验证时遇到问题。

在自述文件中,他找到了使用Restful Authentication进行配置的示例,我想知道如何在一般的Authlogic设置中执行相同操作?

    #environment.rb 
    Comatose.configure do |config|
      # Includes AuthenticationSystem in the ComatoseController
      config.includes << :authenticated_system
    end

http://github.com/darthapo/comatose

1 个答案:

答案 0 :(得分:0)

我认为更好的方法是将auth方法移到模块中,并将其包含在ApplicationController和comatose中。例如:

将您的auth方法放入user_sessions_helper:

module UserSessionsHelper
  module AuthMethods
    private 
      ...
    def require_user
      ...

然后在ApplicationController中包含该模块:

  class ApplicationController < ActionController::Base
     include UserSessionsHelper::AuthMethods
     ...

最后在comatose配置中(environment.rb):

Comatose.configure do |config|
  config.admin_includes << "UserSessionsHelper::AuthMethods"   
  config.admin_authorization = :require_user
end