Module: Wallaby::ApplicationConcern
- Extended by:
- ActiveSupport::Concern
- Includes:
- Engineable, Urlable
- Defined in:
- lib/concerns/wallaby/application_concern.rb
Overview
Here, it provides the most basic functions e.g. error handling for common 4xx HTTP status, helpers method, and URL handling.
Instance Method Summary collapse
-
#bad_request(exception = nil) ⇒ Object
Bad request page.
-
#healthy ⇒ Object
Health check page.
-
#helpers ⇒ Object
helpers exists since Rails 5.0, need to mimic this to support Rails 4.2.
-
#internal_server_error(exception = nil) ⇒ Object
Internal server error page.
-
#not_found(exception = nil) ⇒ Object
Not found page.
-
#not_implemented(exception = nil) ⇒ Object
Not implemented.
-
#unprocessable_entity(exception = nil) ⇒ Object
Unprocessable entity page.
Methods included from Urlable
#edit_path, #index_path, #new_path, #show_path, #url_for
Methods included from Engineable
#current_engine, #current_engine_name, #current_engine_route, #script_name
Instance Method Details
#bad_request(exception = nil) ⇒ Object
Bad request page
35 36 37 |
# File 'lib/concerns/wallaby/application_concern.rb', line 35 def bad_request(exception = nil) render_error exception, __callee__ end |
#healthy ⇒ Object
Health check page
23 24 25 |
# File 'lib/concerns/wallaby/application_concern.rb', line 23 def healthy render plain: 'healthy' end |
#helpers ⇒ Object
helpers exists since Rails 5.0, need to mimic this to support Rails 4.2.
62 63 64 |
# File 'lib/concerns/wallaby/application_concern.rb', line 62 def helpers @helpers ||= defined?(super) ? super : try(:view_context) end |
#internal_server_error(exception = nil) ⇒ Object
Internal server error page
47 48 49 |
# File 'lib/concerns/wallaby/application_concern.rb', line 47 def internal_server_error(exception = nil) render_error exception, __callee__ end |
#not_found(exception = nil) ⇒ Object
Not found page
29 30 31 |
# File 'lib/concerns/wallaby/application_concern.rb', line 29 def not_found(exception = nil) render_error exception, __callee__ end |
#not_implemented(exception = nil) ⇒ Object
Not implemented
53 54 55 |
# File 'lib/concerns/wallaby/application_concern.rb', line 53 def not_implemented(exception = nil) render_error exception, __callee__ end |
#unprocessable_entity(exception = nil) ⇒ Object
Unprocessable entity page
41 42 43 |
# File 'lib/concerns/wallaby/application_concern.rb', line 41 def unprocessable_entity(exception = nil) render_error exception, __callee__ end |