Ruby on Rails Sunday, September 5, 2010

When navigating to: http://localhost:3000/users/12

Whats a good way of avoiding the error: "Couldn't find User with
ID=12", which happens when i try to display a page of user_id 12 that
doesnt exist in the database.

Instead of showing the error. id like to show a page that says: "This
user does not exist"

Someone suggested using rescue_from. Is this the best solution for
this? Or are there better alternative approaches?

--
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