Module: PagesCore::ErrorRenderer
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController
- Defined in:
- app/controllers/concerns/pages_core/error_renderer.rb
Instance Method Summary collapse
-
#render_error(error, options = {}) ⇒ Object
Renders a fancy error page from app/views/errors.
Instance Method Details
#render_error(error, options = {}) ⇒ Object
Renders a fancy error page from app/views/errors. If the error name is numeric, it will also be set as the response status. Example:
render_error 404
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/concerns/pages_core/error_renderer.rb', line 11 def render_error(error, = {}) [:status] ||= error if error.is_a? Numeric respond_to do |format| format.html do [:layout] = error_layout(error, ) @email = current_user.try(&:email) || "" render({ template: "errors/#{error}" }.merge()) end format.any { head [:status] } end true end |