Class: Kadmin::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Kadmin::ApplicationController
show all
- Includes:
- Concerns::AuthorizedUser
- Defined in:
- app/controllers/kadmin/application_controller.rb
Class Attribute Summary collapse
Instance Method Summary
collapse
#authorize, #authorized?, #authorized_user, #current_user, #logged_in?
Class Attribute Details
.navbar_section ⇒ Object
Returns the value of attribute navbar_section
18
19
20
|
# File 'app/controllers/kadmin/application_controller.rb', line 18
def navbar_section
@navbar_section
end
|
Instance Method Details
#handle_error(error, options = {}) ⇒ Object
42
43
44
45
46
47
48
49
50
|
# File 'app/controllers/kadmin/application_controller.rb', line 42
def handle_error(error, options = {})
options = {
title: error.try(:title) || error.class.name,
message: error.message,
status: :internal_server_error,
error: error
}.merge(options)
render 'kadmin/error', status: options[:status], locals: options
end
|
#handle_unexpected_error(error) ⇒ Object
37
38
39
40
|
# File 'app/controllers/kadmin/application_controller.rb', line 37
def handle_unexpected_error(error)
Rails.logger.error(error)
handle_error(error, title: I18n.t('kadmin.errors.unexpected'), message: I18n.t('kadmin.errors.unexpected_message'))
end
|
#not_found(error) ⇒ Object
33
34
35
|
# File 'app/controllers/kadmin/application_controller.rb', line 33
def not_found(error)
handle_error(error, title: I18n.t('kadmin.errors.not_found'), status: :not_found)
end
|
#params_missing(error) ⇒ Object
29
30
31
|
# File 'app/controllers/kadmin/application_controller.rb', line 29
def params_missing(error)
handle_error(error, title: I18n.t('kadmin.errors.params_missing'), status: :bad_request)
end
|