This is a very simple Rails Engine for replacing the standard (ugly) Rails exception pages with pages which are rendered in your layout.


Add the gem to your Gemfile, run `bundle install` and restart your server:

gem 'err_merchant'

This is it. If you want to check the error pages in development mode, make sure to set config.consider_all_requests_local to false and restart your development server.

Should I keep the standard Rails error pages around?

Yes, these files are used as a fallback if err_merchant itself raises an exception. This can happen if there is an error in your application layout.


  • ErrMerchant.layout: Can be used to set the layout for the error pages. By default the application-layout is used.

  • ErrMerchant.skip_filters: Can be used to skip certain filters when rendering errors. Most common are filters by authorization gems like `cancan` or `pundit` which ensure that authorization happens. These have to be skipped when rendering error pages. (example: `ErrMerchant.skip_filters = [:verify_authorized]` for pundit)


You can translate the error messages, by default they are the same as the standard Rails errors:

    title: "The page you were looking for doesn't exist."
    description: "You may have mistyped the address or the page may have moved."
    title: "The change you wanted was rejected."
    description: "Maybe you tried to change something you didn't have access to."
    title: "We're sorry, but something went wrong."
    description: "We've been notified about this issue and we'll take a look at it shortly."

Please note that there are translations missing in development mode if you don't supply translations for your locale. In production however, config.i18n.fallbacks is usually set to true, so the error messages for the default locale will be shown if the lookup is not successful.


0.7.1 (2022-04-07)

  • Relax version requirement for rails

0.7.0 (2021-01-05)

  • Disable CSRF in ErrorsController

  • Drop support for rails < 5.2

0.6.0 (2019-06-07)

  • Relax version requirement for rails

  • Drop support for rails < 5

0.5.0 (2018-08-09)

  • ErrorsController inherits from ApplicationController again (so helpers etc. defined there are available). Added ErrMerchant.skip_filters for previously hardcoded behavior.

0.4.0 (2018-08-09)

  • Relax rails requirements

  • Remove special cases for CanCan / Pundit, instead inherit from ActionController::Base (so we don't get any before_action we don't like)

0.3.1 (2014-11-08)

  • works with `pundit` now

  • show error messages raw

0.3.0 (2014-10-24)

  • compatible with rails 4

0.2.0 (2012-01-30)

  • only supports rails 3.2 (code cleanup)

0.1.2 (2012-01-12)

  • added configuration option for layout

0.1.1 (2012-01-12)

  • fix gemspec

  • add test for fallback to standard rails error pages

  • fix issue with CanCan

0.1.0 (2012-01-11)

  • Initial release


This project rocks and uses MIT-LICENSE.