"assets" are prefixed with link_to

I have a link_to in a partial that generates a different url when the page is accessed as root, then if accessed using a controller / index. When accessing it as root, the url that creates link_to has the "assets" prefix which doesn't work.

Can anyone explain why this is happening?

Rails 3.2.1 Ruby 1.9.3

+3


source to share


1 answer


With some help from the Rails IRC channel, I found the problem. I have not used helper paths in the link. If it helps someone else, here's what I did to fix it;

doesn't work when root;

<% = link_to 'Gifts detail' ,: controller => 'gifts' ,: action => 'index'%>



works at any time;

<% = link_to 'Gifts detail', gifts_path%>

0


source







All Articles