Using url_for to generate path without declaring route
In my views, I'm generating links to static pages like this one:
link_to "Terms", "/tos"
which results in the relative URL localhost:3000/tos . I'm trying to use a Rails routing helper to generate the same url, so that the https://github.com/svenfuchs/routing-filter gem I'm using will prepend the current locale automatically:
link_to "Terms", url_for("/tos")
=> /en/tos
This doesn't work, however - the path like above is taken ver开发者_如何学Pythonbatim. I also don't have a route for the static pages (they're served with a before_filter), so I can't use the usual :controller, :action form. url_for also doesn't have a :path parameter.
Is there any trick I can use to generate this path without a route ?
精彩评论