I find this proposal to be valuable. I have not been aware of the old behaviour but the new one just makes sense and makes the developer experience better.
– Vesa Vänskä On Friday, October 16, 2015 at 2:20:00 PM UTC+3, Kir Shatrov wrote: > > Imagine a case: you want to render Not found page somewhere from the > controller. > You could raise `ActiveRecord::NotFoundError` or > `ActionController::RoutingError`, but none of them are related to your > error case: it's neither ActiveRecord nor Routing error. > We usually use `head :not_found` in such cases. > > The current issue with `head :not_found` is that in development it renders > a blank page and in production it renders fancy `public/404.html`. I'm > familiar with this behaviour, but it may be quite struggling for developers > who are new to Rails. > > During the code review, I've noticed that developers explicitly create a > new `render_not_found` method, where they read `public/404.html` and render > the contests because they see that `head :not_found` results to a blank > page (and they don't know that it's in development only!) > > I propose to change the behaviour of `ActionDispatch::PublicExceptions` to > catch display error pages that were trigger by developer (like `head > :not_found` was in my example) > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
