Make any kind of params to a path
# :controller=>'xxx' --> /xxx # /xxx -> /xxx # http://adasd.com/xxx -> /xxx def path_for(path) if path.is_a? Hash url_for(path.merge(:only_path=>true)) else URI.parse(path).path end end
Make any kind of params to a path
# :controller=>'xxx' --> /xxx # /xxx -> /xxx # http://adasd.com/xxx -> /xxx def path_for(path) if path.is_a? Hash url_for(path.merge(:only_path=>true)) else URI.parse(path).path end end
Shouldn’t the merge be the other way?
url_for {:only_path=>true}.merge(path || {})
(and don’t forget to check for nil)
oh, wait, no you’re right the first time