Module: HyperKittenMeow::Concerns::Controllers::Admin::AdminController
- Extended by:
- ActiveSupport::Concern
- Includes:
- Pagy::Backend
- Included in:
- Admin::AdminController
- Defined in:
- lib/hyper_kitten_meow/concerns/controllers/admin/admin_controller.rb
Instance Method Summary collapse
Instance Method Details
#authorize ⇒ Object
20 21 22 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/admin_controller.rb', line 20 def raise ActionController::RoutingError.new('Not Found') unless logged_in? end |
#current_user ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/admin_controller.rb', line 24 def current_user if (user_id = session[:user_id]) @current_user ||= User.find_by(id: user_id) elsif (user_id = .signed[:user_id]) user = User.find_by(id: user_id) if user && user.authenticated?([:remember_token]) session[:user_id] = user.id @current_user = user end end end |
#logged_in? ⇒ Boolean
36 37 38 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/admin_controller.rb', line 36 def logged_in? current_user.present? end |