Ruby on Rails Monday, May 31, 2010

Quoting Joshua Partogi <joshua.partogi@gmail.com>:
> Hi all,
>
>
> I want to be able to display 404 page from a controller when a record
> in the database can not be found. I am using Rails 3 at the moment. I
> tried to find how to do this on guides.rails.info with no luck. Can
> anybody recommend the best approach to do this?
>

Have you tried raising ActiveRecord::NotFound in the controller? Or just let
the model raise it.

Jeffrey

P.S. not actually tried this in Rails 3, this works for me in Rails 1.x and
2.x.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment