config.exceptions_app = self.routes
to application.rb.
2. Add routes for error pages :
match '/404', :to => 'errors#not_found'
match '/422', :to => 'errors#server_error'
match '/500', :to => 'errors#server_error'
3. Create a errors controller:
rails g controller errors not_found server_error
4. Implement the actions :
class ErrorsController < ApplicationController
def not_found
render :status => 404, :formats => [:html]
end
def server_error
render :status => 500, :formats => [:html]
end
end
5. Customize the views, not_found.html.erb and server_error.html.erb.