Class: ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ApplicationController
- Includes:
- Pagy::Backend
- Defined in:
- app/controllers/application_controller.rb
Overview
This controller contain the methods shared for all controller
Direct Known Subclasses
Admin::ApplicationController, Editor::ApplicationController, EventsController, HappeningsController, TicketsController
Instance Method Summary collapse
-
#access_denied! ⇒ nil
private
Render 401 page and stop the work.
- #default_url_options ⇒ Object
-
#record_not_found! ⇒ nil
private
Render 404 page and stop the work.
- #set_turbo ⇒ Object private
- #switch_locale(&action) ⇒ Object private
Instance Method Details
#access_denied! ⇒ nil (private)
Render 401 page and stop the work
31 32 33 |
# File 'app/controllers/application_controller.rb', line 31 def access_denied! render "errors/401", status: :unauthorized and return end |
#default_url_options ⇒ Object
8 9 10 |
# File 'app/controllers/application_controller.rb', line 8 def { locale: I18n.locale } end |
#record_not_found! ⇒ nil (private)
Render 404 page and stop the work
25 26 27 |
# File 'app/controllers/application_controller.rb', line 25 def record_not_found! render partial: "errors/404", status: :not_found and return end |
#set_turbo ⇒ Object (private)
35 36 37 |
# File 'app/controllers/application_controller.rb', line 35 def set_turbo @turbo = request.headers["turbo-frame"].present? end |
#switch_locale(&action) ⇒ Object (private)
18 19 20 21 |
# File 'app/controllers/application_controller.rb', line 18 def switch_locale(&action) locale = params[:locale] || I18n.default_locale I18n.with_locale(locale, &action) end |