Reputation: 71
I am near finishing my first rails application and I was wondering how I should handle routing errors and other errors concerning urls in general.
For example, someone trying to access "../usorz" instead of "../users" would get the error:
No route matches [GET] "/usorz"
Is it better to leave it as it is now, or should I do something. And if I should do something, what's the best way to do it?
Thank you for your time.
Upvotes: 0
Views: 587
Reputation: 749
The reality is, as of Rails 3, ApplicationController can't catch ActionController::RoutingError and thus, we cannot take advantage of rescue_from like we used to for ActiveRecordErro::RecordNotFound.
There is nice blog how we can manage this in simple way. http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution
Upvotes: 0
Reputation: 12643
Allow the error. Your app will respond with a 404 status which is correct.
Upvotes: 1