ruby on rails - Path helper inserts plus sign instead of space -
i want have link_to with
<%= link_to "my link", search_path(par: "my link") %>
but gets rendered
<a href="/search?par=my+link">my link</a>
instead of
<a href="/search?par=my link">my link</a>
is there way force behave properly, , not manually insert %20
instead of space?
try this
require 'cgi' cgi.unescape "/search?par=my+link"
example:
1.9.3p448 :006 > cgi.unescape "/search?par=my+link" => "/search?par=my link" 1.9.3p448 :007 > cgi.unescape "/search?par=my%20link" => "/search?par=my link"
hope helps!
Comments
Post a Comment