views:

109

answers:

1

I started using comatose to handle content on my site but am having problems using it with my existing authentication using a generic Authlogic config.

In the readme he sites an example for configuring it with Restful Authentication and I'm wondering how I would do the same within a general Authlogic setup?

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

http://github.com/darthapo/comatose

A: 

I think a better way to do it is moving the auth methods out into a module, and include that from both ApplicationController and comatose. Example:

Put your auth methods into user_sessions_helper:

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

Then include the module in your ApplicationController:

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

And finally in the comatose config as well (environment.rb):

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