Q:

Rails production 404,500 etc error pages with same layout as rest webpages

How could i render my error pages in production mode, so that they are in same layout as rest pages? For example, not 404 as standart 
<h1>The page you were looking for doesn't exist.</h1>
    <p>You may have mistyped the address or the page may have moved.</p>

without any layout, but this message in my layout (called application.html.haml)? 
Is it real? And what and where i need to write? I google'd but for own layout didn't find good one....
i use rails 3.2.8, ruby 1.9.3

A:

One solution would be this:
# In config/application.rb
config.exceptions_app = self.routes

# In routes
match "/404", to: "errors#not_found"
match "/500", to: "errors#server_error"

# app/controllers/errors_controller.rb

class ErrorsController < ApplicationController
  # Inherits layout from ApplicationController 

  def not_found
  end

  def server_error
  end
end

# app/views/errors/not_found.haml
%h1 Didn't find nothing!

# app/views/errors/server_error.haml
%h1 FUBAR!

