forked from railsadminteam/rails_admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Sorcery
stas edited this page Jul 26, 2012
·
5 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
endYou 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
endThere'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)