Henrik N
2013-Jun-26 12:38 UTC
Idea: status code 404 AND debug info for RecordNotFound, RoutingError
The exceptions ActiveRecord::RecordNotFound and ActionController::RoutingError will give a 500 status in dev and test, but 404 in production. This means you can''t easily write JS to rely on 404 responses from Ajax requests: it will work in production but not dev or test. It might be sensible to have Rails still show the useful debug info for these exceptions in dev and test, but with a 404 status code. What do you think? -- 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 rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
Henrik N
2013-Jun-26 12:48 UTC
Re: Idea: status code 404 AND debug info for RecordNotFound, RoutingError
Actually, RoutingError seems to do this already. I noticed the lack in RecordNotFound, and incorrectly assumed RecordNotFound had the same problem. So RoutingError gets it right, but maybe RecordNotFound should do the same? On Wednesday, June 26, 2013 2:38:41 PM UTC+2, Henrik N wrote:> > The exceptions ActiveRecord::RecordNotFound and ActionController::RoutingError > will give a 500 status in dev and test, but 404 in production. > > This means you can''t easily write JS to rely on 404 responses from Ajax > requests: it will work in production but not dev or test. > > It might be sensible to have Rails still show the useful debug info for > these exceptions in dev and test, but with a 404 status code. > > What do you think? >-- 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 rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
Bob Breznak
2013-Jun-26 18:09 UTC
Re: Re: Idea: status code 404 AND debug info for RecordNotFound, RoutingError
This seems like a regression in 4.0.0. I believe that previous versions were returning 404''s for RecordNotFound in development. -- Bob Breznak @bobbrez 617 863 0262 On Wednesday, June 26, 2013 at 8:48 AM, Henrik N wrote:> Actually, RoutingError seems to do this already. I noticed the lack in RecordNotFound, and incorrectly assumed RecordNotFound had the same problem. > > So RoutingError gets it right, but maybe RecordNotFound should do the same? > > On Wednesday, June 26, 2013 2:38:41 PM UTC+2, Henrik N wrote: > > The exceptions ActiveRecord::RecordNotFound and ActionController::RoutingError will give a 500 status in dev and test, but 404 in production. > > > > This means you can''t easily write JS to rely on 404 responses from Ajax requests: it will work in production but not dev or test. > > > > It might be sensible to have Rails still show the useful debug info for these exceptions in dev and test, but with a 404 status code. > > > > What do you think? > > -- > 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 rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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 rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
Henrik Nyh
2013-Jun-27 19:07 UTC
Re: Re: Idea: status code 404 AND debug info for RecordNotFound, RoutingError
Oh, I let the custom better_errors page fool me. The standard error page does give a 404 for RecordNotFound (in 3.2, but I''m sure Rails 4 works as well). Sorry to bring this up before experimenting more, and thanks for pointing me in the right direction. On Wed, Jun 26, 2013 at 8:09 PM, Bob Breznak <bob.breznak@gmail.com> wrote:> This seems like a regression in 4.0.0. I believe that previous versions > were returning 404''s for RecordNotFound in development. > > -- > Bob Breznak > @bobbrez > 617 863 0262 > > On Wednesday, June 26, 2013 at 8:48 AM, Henrik N wrote: > > Actually, RoutingError seems to do this already. I noticed the lack in > RecordNotFound, and incorrectly assumed RecordNotFound had the same problem. > > So RoutingError gets it right, but maybe RecordNotFound should do the same? > > On Wednesday, June 26, 2013 2:38:41 PM UTC+2, Henrik N wrote: > > The exceptions ActiveRecord::RecordNotFound and ActionController::**RoutingError > will give a 500 status in dev and test, but 404 in production. > > This means you can''t easily write JS to rely on 404 responses from Ajax > requests: it will work in production but not dev or test. > > It might be sensible to have Rails still show the useful debug info for > these exceptions in dev and test, but with a 404 status code. > > What do you think? > > -- > 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 rubyonrails-core+unsubscribe@googlegroups.com. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ruby on Rails: Core" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/rubyonrails-core/0s569FMzBKI/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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 rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.