Blacklight Plugin

Authlogic error

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.4
  • Component/s: None
  • Description:
    Hide
    I get this error with latest out of trunk:

    Authlogic::Session::Activation::NotActivatedError in Catalog#index

    Showing vendor/plugins/blacklight/app/views/catalog/_bookmark_control.html.erb where line #1 raised:

    You must activate the Authlogic::Session::Base.controller with a controller object before creating objects

    Extracted source (around line #1):

    1: <% if current_user and current_user.document_is_bookmarked? document[:id] %>
    2: <span>This item is in your <%= link_to 'bookmarks', bookmarks_path %></span>
    3: <% elsif current_user %>
    4: <%- @bookmark ||= Bookmark.new -%>

    Trace of template inclusion: vendor/plugins/blacklight/app/views/catalog/_document_list.html.erb, vendor/plugins/blacklight/app/views/catalog/index.html.erb

    =====================================

    I've monkey patched my copy to comment out the following in the plugin's application_controller.rb:
     def current_user_session
          return @current_user_session if defined?(@current_user_session)
          #@current_user_session = UserSession.find
        end

        def current_user
          return @current_user if defined?(@current_user)
          #@current_user = current_user_session && current_user_session.user
        end

    When application_controller.rb from the plugin is copied to the rails application level leaving @current_user uncommented works. For some reason it only fails for the version inside the plugin.

    I should also say that it works uncommented on one machine but not on another. The machine where it is not working is running Ruby Enterprise Edition.
    Show
    I get this error with latest out of trunk: Authlogic::Session::Activation::NotActivatedError in Catalog#index Showing vendor/plugins/blacklight/app/views/catalog/_bookmark_control.html.erb where line #1 raised: You must activate the Authlogic::Session::Base.controller with a controller object before creating objects Extracted source (around line #1): 1: <% if current_user and current_user.document_is_bookmarked? document[:id] %> 2: <span>This item is in your <%= link_to 'bookmarks', bookmarks_path %></span> 3: <% elsif current_user %> 4: <%- @bookmark ||= Bookmark.new -%> Trace of template inclusion: vendor/plugins/blacklight/app/views/catalog/_document_list.html.erb, vendor/plugins/blacklight/app/views/catalog/index.html.erb ===================================== I've monkey patched my copy to comment out the following in the plugin's application_controller.rb:  def current_user_session       return @current_user_session if defined?(@current_user_session)       #@current_user_session = UserSession.find     end     def current_user       return @current_user if defined?(@current_user)       #@current_user = current_user_session && current_user_session.user     end When application_controller.rb from the plugin is copied to the rails application level leaving @current_user uncommented works. For some reason it only fails for the version inside the plugin. I should also say that it works uncommented on one machine but not on another. The machine where it is not working is running Ruby Enterprise Edition.

Activity

Hide
Jason Ronallo added a comment - 02/Jun/09 8:49 AM
Placing
before_filter :activate_authlogic
In my controllers seems to have solved this issue from cropping up occasionally.

http://www.themomorohoax.com/2009/02/23/authlogic-session-notactivated-you-must-activate-the-authlogic-session-base-controller-with-a-controller-object-before-creating-objects
Show
Jason Ronallo added a comment - 02/Jun/09 8:49 AM Placing before_filter :activate_authlogic In my controllers seems to have solved this issue from cropping up occasionally. http://www.themomorohoax.com/2009/02/23/authlogic-session-notactivated-you-must-activate-the-authlogic-session-base-controller-with-a-controller-object-before-creating-objects
Hide
Jamie Orchard-Hays added a comment - 02/Jun/09 9:36 AM
Jason, do you have config.gem "authlogic" in your environments file?
Show
Jamie Orchard-Hays added a comment - 02/Jun/09 9:36 AM Jason, do you have config.gem "authlogic" in your environments file?
Hide
Jason Ronallo added a comment - 02/Jun/09 1:57 PM
Yes, I do.

I even installed the authlogic gem on the server since I was getting some gem dependency errors as well.

Which controllers rely on authlogic? I've added it to ApplicationController and CatalogController (since I've had to override those anyway). Others that will need the before_filter?
Show
Jason Ronallo added a comment - 02/Jun/09 1:57 PM Yes, I do. I even installed the authlogic gem on the server since I was getting some gem dependency errors as well. Which controllers rely on authlogic? I've added it to ApplicationController and CatalogController (since I've had to override those anyway). Others that will need the before_filter?
Hide
Jamie Orchard-Hays added a comment - 02/Jun/09 4:11 PM
There's some larger issue than using the activate command in the controllers. I don't believe you should need to call activate. The demo app is running fine without calling activate. Something's not configured correctly somewhere as Authlogic mixes into the controllers.
Show
Jamie Orchard-Hays added a comment - 02/Jun/09 4:11 PM There's some larger issue than using the activate command in the controllers. I don't believe you should need to call activate. The demo app is running fine without calling activate. Something's not configured correctly somewhere as Authlogic mixes into the controllers.
Hide
Jason Ronallo added a comment - 03/Jun/09 11:46 AM
Even though it is working in the demo app is it known to be working with a fresh rails and installation of the blacklight plugin?
Show
Jason Ronallo added a comment - 03/Jun/09 11:46 AM Even though it is working in the demo app is it known to be working with a fresh rails and installation of the blacklight plugin?
Hide
Jamie Orchard-Hays added a comment - 03/Jun/09 2:00 PM
Jason, I'm in the middle of installing BL in a fresh rails application for the first time. I'd say the instructions are wrong in several places and we need some serious work on this, so I'm going to get on it ASAP.

Anyway, once I got things up and running, I had no load issues. No errors with the controllers, etc. Did you remove application_controller.rb from the main rails app?

Also, do you have

  require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

above the initializer and

  config.gem 'authlogic'
  config.plugin_paths += ["#{RAILS_ROOT}/vendor/plugins/blacklight/vendor/plugins"]
  config.plugins = %W(engines blacklight acts_as_taggable_on_steroids resource_controller)

inside?
Show
Jamie Orchard-Hays added a comment - 03/Jun/09 2:00 PM Jason, I'm in the middle of installing BL in a fresh rails application for the first time. I'd say the instructions are wrong in several places and we need some serious work on this, so I'm going to get on it ASAP. Anyway, once I got things up and running, I had no load issues. No errors with the controllers, etc. Did you remove application_controller.rb from the main rails app? Also, do you have   require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') above the initializer and   config.gem 'authlogic'   config.plugin_paths += ["#{RAILS_ROOT}/vendor/plugins/blacklight/vendor/plugins"]   config.plugins = %W(engines blacklight acts_as_taggable_on_steroids resource_controller) inside?
Hide
Naomi Dushay added a comment - 25/Sep/09 12:41 PM
I believe this was fixed when we ditched auth_logic (to avoid dependency on bcrypt to avoid problems for windows users) and started using simplest_auth instead.
Show
Naomi Dushay added a comment - 25/Sep/09 12:41 PM I believe this was fixed when we ditched auth_logic (to avoid dependency on bcrypt to avoid problems for windows users) and started using simplest_auth instead.

People

Dates

  • Created:
    01/Jun/09 4:01 PM
    Updated:
    25/Sep/09 12:41 PM
    Resolved:
    25/Sep/09 12:41 PM