-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Sorcery
Barry Hoggard edited this page Sep 7, 2019
·
8 revisions
Here are listed community proposed solutions to solve Sorcery and RailsAdmin compatibility:
This was proposed by David Tuite on SO
Authentication with Sorcery requires manual tweaking of rails_admin.rb
initializer.
RailsAdmin.config do |config|
config.authenticate_with do
# Use sorcery's before filter to auth users
require_login
end
config.current_user_method(&:current_user)
end
You will also need to update the not_authenticated
in your application_controller.rb
:
class ApplicationController
# Overwrite the method sorcery calls when it
# detects a non-authenticated request.
def not_authenticated
# Make sure that we reference the route from the main app.
redirect_to main_app.login_path
end
end
There's a solution proposed by @adamkangas, for context, see #147
This requires forcing Sorcery::Controller
inclusion at the end of sorcery.rb
initializer:
ActionController::Base.send(:include, Sorcery::Controller)