Question

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.

Was it helpful?

Solution 2

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

OTHER TIPS

Allow the error. Your app will respond with a 404 status which is correct.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top