Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete AuthlogicLoadedTooLateError #681

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions lib/authlogic/controller_adapters/rails_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ module ControllerAdapters
# Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite,
# etc.
class RailsAdapter < AbstractAdapter
# :nodoc:
class AuthlogicLoadedTooLateError < StandardError
def message
<<~EOS.squish
Authlogic is trying to add a callback to ActionController::Base but
ApplicationController has already been loaded, so the callback won't
be copied into your application. Generally this is due to another
gem or plugin requiring your ApplicationController prematurely, such
as the resource_controller plugin. Please require Authlogic first,
before these other gems / plugins.
EOS
end
end

def authenticate_with_http_basic(&block)
controller.authenticate_with_http_basic(&block)
end
Expand All @@ -43,16 +29,7 @@ def request_content_type
# "activates" authlogic.
module RailsImplementation
def self.included(klass) # :nodoc:
if defined?(::ApplicationController)
raise AuthlogicLoadedTooLateError
end

# In Rails 4.0.2, the *_filter methods were renamed to *_action.
if klass.respond_to? :prepend_before_action
klass.prepend_before_action :activate_authlogic
else
klass.prepend_before_filter :activate_authlogic
end
klass.prepend_before_action :activate_authlogic
end

private
Expand Down