Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Turn off error display

When I access a post that doesn't exist in my Rails project via the URL /posts/13, the browser shows a verbose error:

ActiveRecord::RecordNotFound in PostsController#show

Couldn't find Post with ID=13
Rails.root: ...
...
Request

Parameters:

{"id"=>"13"}
...

Is there a way to turn this detailed error display off?

like image 223
Paul S. Avatar asked Dec 27 '22 16:12

Paul S.


1 Answers

Try this:

  • run a server in production $ rails s -e production

  • remove ActionDispatch::DebugExceptions middleware

    config.middleware.delete(ActionDispatch::DebugExceptions)

  • set config.consider_all_requests_local = false in your environment config

like image 158
shime Avatar answered Jan 09 '23 10:01

shime