Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling Rails ActionController::BadRequest

So, going to http://localhost:3000/%ED will throw ActionController::BadRequest.

But what I really want if return a 404 page (like most websites do).

For instance, Twitter will say:

Invalid Unicode value in one or more parameters /%ED

And me I get that in development (and a 500 error page in production):

going to localhost:3000/%ED

I tried the obvious rescue_from but the error doesn't even it my application as it's raised in the routing stack.

Any idea? I thought about a middleware but doesn't know how I would do it?

like image 987
Dorian Avatar asked Jul 17 '14 15:07

Dorian


1 Answers

I used utf8-cleaner and it works really fine.

like image 137
Dorian Avatar answered Nov 20 '22 21:11

Dorian