I'm rendering a header with links to various controllers in the application
file
The path that link_to
uses seems to be relative to the current page, and it just directs to the current URL minus one instance of a forward slash. This doesn't work if you're any level deeper than first one.
For instance, clicking a link to the posts
controller works while you're on posts#index
, but being on posts/1
directs you to posts/posts
Have routes got anything to do with this?
I just rectified this problem by adding a forward slash before the destination.
link_to "posts", "/posts"