Search code examples
ruby-on-railsrubyexceptionhandler

Rails exception_handler gem not updating 404 page


I am using the exception_handler gem to make a custom 404 page. When I go to the 404 page on my site and it shows not found but how do I customize this page? I tried changing the routes, make errors_controller and not_found view.

application.rb

config.exceptions_app = self.routes

routes.rb

  get "/404", :to => "errors#not_found"
  get "/422", :to => "errors#unacceptable"
  get "/500", :to => "errors#internal_error"

errors_controller.rb

class ErrorsController < ApplicationController

  def not_found
    render :status => 404   end

  def unacceptable
    render :status => 422   end

  def internal_error
    render :status => 500   end

end

app/views/errors/not_found.html.erb

<label> TEST 404 Label </label>

Solution

  • I forgot to run rails g exception_handler:views this generated all the views in my project file now I can customize them to my liking.