Frage

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.

War es hilfreich?

Lösung 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

Andere Tipps

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top