ruby - Is there any way to encode the URL at runtime in rails? -
in rails application, have search functionality. user may directly enter search string in url. if user enters search string '%'
, url becomes:
http://localhost:3000/search/%
and produces bad request error. there option encode url @ runtime?
the question you're asking wouldn't solve problem you're describing. yes, rails can encode url @ runtime, in fact encodes many urls @ runtime in normal operation.
but, won't you, what's happening when users create url %
in it, they're creating invalid url - not rails, web server, or web application server or framework.
if closely @ error returned in browser, it's not rails, it's webrick (or whatever httpd you're using), same error logged logs, it's not normal rails error in routing or elsewhere.
the upshot of no, can't handle in rails because in many cases won't through rails, , it's totally invalid url.
Comments
Post a Comment