Is there a way to customise sorcery's require_login function to provide a flash message and to redirect to page other than root_path e.g. to a login page?
Customise sorcery's require_login function
420 views Asked by Obromios At
1
Is there a way to customise sorcery's require_login function to provide a flash message and to redirect to page other than root_path e.g. to a login page?
This can be done by overriding sorcery's not_authenticated function, which it calls when the user is not logged in, for example
app/controller/application_controller.rb
Also make sure that the rails_admin controllers are inheriting from your application controller;
config/initializers/rails_admin.rb
RailsAdmin.config do |config| ... config.parent_controller = 'ApplicationController' end