Class: ErrorsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ErrorsController
- Defined in:
- app/controllers/errors_controller.rb
Instance Method Summary collapse
-
#show ⇒ Object
General Exception Handling: Show Message on Error Page ————————————————————————-.
-
#unauthorized ⇒ Object
Unauthorized Error: Redirect to Login Page ————————————————————————-.
Methods inherited from ApplicationController
#current_navable, #current_navable=, #current_user, #point_navigation_to, #redirect_www_subdomain, #set_locale
Instance Method Details
#show ⇒ Object
General Exception Handling: Show Message on Error Page
10 11 12 13 14 15 16 |
# File 'app/controllers/errors_controller.rb', line 10 def show @exception = env["action_dispatch.exception"] respond_to do |format| format.html #{ render action: request.path[1..-1] } format.json { render json: {status: request.path[1..-1], error: (@exception. || "Zeitüberschreitung (Timeout).")} } end end |
#unauthorized ⇒ Object
Unauthorized Error: Redirect to Login Page
21 22 23 24 25 |
# File 'app/controllers/errors_controller.rb', line 21 def if not current_user redirect_to sign_in_path, flash: { error: I18n.t(:unauthorized_please_sign_in) } end end |