Catch all exceptions and display dynamic error page Ruby on Rails 4 -
I am currently working on a Rail 4 app and came to the point where I display a custom error page Users want an exception when it is currently 500. In the public directory, using the HTML.
How can I get an app instead of rendering an ARB file because I have to keep some dynamic stuff on the page
There are:
ActionController :: Base Rescue_profor IAWWORD :: Exception. Exceptions | Render_403 (exception) end def render_403 (exception) logger.warn ("message for log.") @error_message = exception.message response_to do | Format | Format.html {Render Template: 'Errors / Errors', Layout: False, Status: 500} format.all {None Render: True, Position: 500} End End End You can now create a sequence in the error folder errors.html.erb and render the
@error_message variable.
Comments
Post a Comment