Topic: url path issue

Hi all,

I have a db site working and i am trying to get the url of the post i.e. <%= link_to 'Show', test %> and put it in a <a></a> depending on the post being selected and the closest i have got is with <a href="<%= job %>"></a> which it does not display the url of the post, it displays #<Job:0x007fe73c082b10> in the address bar. How can it get the url i.e. tests/1 etc and get this to render into href  with the link tag for the post that I'm selecting.


Thanks

Re: url path issue

paulie wrote:

Hi all,

I have a db site working and i am trying to get the url of the post i.e. <%= link_to 'Show', test %> and put it in a <a></a> depending on the post being selected and the closest i have got is with <a href="<%= job %>"></a> which it does not display the url of the post, it displays #<Job:0x007fe73c082b10> in the address bar. How can it get the url i.e. tests/1 etc and get this to render into href  with the link tag for the post that I'm selecting.


Thanks

The link_to is a Rails helper method that produces an HTML equivalent of <a> tag. You don't need to put it in between <a></a> tags. For more read the guide http://guides.rubyonrails.org/

Re: url path issue

Hi,

Oh ok, but i have tried to replace the text of the link_to i.e. <%= link_to ' here ' %> with a <il></il> tag as i want to have the whole <il> as a link but tho just gives me a error.


Thanks

Re: url path issue

Don't worry i sorted it with

<%= link_to ( test ) do %>
<li></li>
<% end %>

Thanks