Module: AdminAuth::Controller
- Defined in:
- lib/admin_auth/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
- #after_login_path(new_locale = locale) ⇒ Object
- #after_logout_path(new_locale = locale) ⇒ Object
- #authenticate_admin! ⇒ Object
- #current_admin ⇒ Object
- #locale ⇒ Object
Class Method Details
.included(controller) ⇒ Object
3 4 5 6 |
# File 'lib/admin_auth/controller.rb', line 3 def self.included(controller) controller.helper_method :current_admin controller.helper_method :locale end |
Instance Method Details
#after_login_path(new_locale = locale) ⇒ Object
20 21 22 |
# File 'lib/admin_auth/controller.rb', line 20 def after_login_path(new_locale = locale) admin_admins_path(new_locale) end |
#after_logout_path(new_locale = locale) ⇒ Object
24 25 26 |
# File 'lib/admin_auth/controller.rb', line 24 def after_logout_path(new_locale = locale) admin_root_path(new_locale) end |
#authenticate_admin! ⇒ Object
8 9 10 |
# File 'lib/admin_auth/controller.rb', line 8 def authenticate_admin! redirect_to admin_login_path(locale) unless current_admin end |
#current_admin ⇒ Object
12 13 14 |
# File 'lib/admin_auth/controller.rb', line 12 def current_admin @current_admin ||= admins_repository.find(id: session[:admin_id]) if session[:admin_id] end |
#locale ⇒ Object
16 17 18 |
# File 'lib/admin_auth/controller.rb', line 16 def locale params[:locale] end |