The project is already in production, I would like to know how to revert every time an error of the url comes up, like the example below, that an image or something appears that this url does not exist. thanks
You can try it in the following way (this is an example):
must delete the default file that is in public, the file 404.html to avoid errors.
it is necessary to modify the application.rb file that is in config and in the routes in the following way taking into account your project:
module NameOfMyApp
class Application < Rails::Application
require Rails.root.join("lib/custom_public_exceptions")
config.exceptions_app = CustomPublicExceptions.new(Rails.public_path)
end
end
Rails.application.routes.draw do
match "/404" => "errors#error404", via: [ :get, :post, :patch, :delete ]
end
Now, you must create the following files in the usual way and add the html you want to be shown in the error:
lib / custom_public_exceptions.rb
app / controllers / errors_controller.rb
app / views / errors / error404.erb