#135 ✓resolved
Walter Smith

activate_authlogic sometimes not automatically attached

Reported by Walter Smith | July 4th, 2009 @ 12:33 AM

The RailsAdapter relies on being loaded before any of the app's controllers, so it can put activate_authlogic in ActionController::Base's filter_chain before it gets copied to the subclasses. However, there's no guarantee this is the case.

For example, if you happen to put giraffesoft-resource_controller's gem statement ahead of authlogic's, it doesn't work. Resource_controller requires ApplicationController, so the filter_chain is initialized before authlogic gets a crack at it.

This results in the dreaded Authlogic::Session::Activation::NotActivatedError (You must activate the Authlogic::Session::Base.controller with a controller object before creating objects).

The workaround is just to make sure authlogic is loaded before any conflicting gems. If there's no foolproof way to ensure the filter gets installed, it would be nice if authlogic could just detect this case and save potential hours of frustration. E.g., like this:

       module RailsImplementation

     def self.included(klass) # :nodoc:


  •    STDERR.puts "Warning: authlogic loaded too late!" if defined?(::ApplicationController)
       klass.prepend_before_filter :activate_authlogic
     end</code>
    


Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.

People watching this ticket

Pages