Domanda

I want to put in single link_to these options.

<%= prods.manufacturer.name %> <%= prods.name %>

So that generated link would be together in single underline. Like Komptech Cribo900, that is one link. But at this moment I have 2 links and clickig on them sends me to manufacturer view or product view. I want to be able to go only to product view.

Product and Manufacturer models have relationship between them.

I tried <%= link_to (prods.manufacturer.name prods.name), prods%> and <%= link_to (prods.manufacturer.name)(prods.name), prods%> with errors. Is there any way to do this ?

Thanks.

È stato utile?

Soluzione

How about using String interpolation:

<%= link_to "#{prods.manufacturer.name} #{prods.name}", prods %>

Altri suggerimenti

<%=link_to "#{prods.manufacturer.name}#{prods.name}", prods%>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top