The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Friday, 13 August 2010

When ActiveRecord does not find a record

In Rails, when ActiveRecord does not find a record with the specified ID raises and exception. A good way to control this exception is to intercept it and respond with an appropriate HTTP status code, in this case a 404. This is a simple example:

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home