link_to ---- articles detail - basic help

I have a basic blog with images - and in the index.rhtml view file I
have the following:

<ul>
<% @contents.each do |content| -%>
  <li><%= content.title %></li>
<li><%= content.summary %></li>

  <li>
   <%= link_to image_tag(content.image.public_filename(:thumb)),
   content, :action => 'show', :id => content %>
  </li>

  <li><%= link_to content, :action => 'show', :id => content %></li>
<% end -%>

</ul>

As soon as I add a name for the link - e.g.

<%= link_to 'view content detail', content, :action => 'show', :id =>
content %>

the link no longer goes to the correct detail page - instead just goes
back to "index". (the same applies to the link_to from the image)

Without the 'view article detail' inserted - the '#' links correctly
url = contents/1 .... contents/2 ....etc etc

just in case....
(routes.rb = map.resources :contents)

What am I missing here?

Thanks in advance

(and yes (previous post), I am still struggling with the IE7 CSS
problem!!)

[...]

I'm certainly no expert, but so far I've found that editing view/foo/
show.rhtml achieves the purposes I need. I'm curious about why you're
editing index.rhtml -- what does that accomplish?

-Thufir

Does removing the first content variable from your link help?

The link_to helper normally takes the form of <%= link_to "Link Text
Here", url_here %> Also, as you're using RESTful routes, you can
rewrite your link as:

<%= link_to "View link details", content_url(content) %>

Robin

I'd strongly recommend using the link_to format that Robin
recommended. As for your specific problem, check the development
log. What kind of http req are you getting, GET or POST? My
suspicion is that you're getting a post which Rails interprets as an
insert into the collection (probably creating a lot of empty records
at this point!) and then you're being redirected back to the index
after the insert.

With Robin's method you can be sure of the http request by:

<%= link_to "View link details", content_url(content, :method=>:get)
%>

AndyV wrote:

I'd strongly recommend using the link_to format that Robin
recommended. As for your specific problem, check the development
log. What kind of http req are you getting, GET or POST? My
suspicion is that you're getting a post which Rails interprets as an
insert into the collection (probably creating a lot of empty records
at this point!) and then you're being redirected back to the index
after the insert.

With Robin's method you can be sure of the http request by:

<%= link_to "View link details", content_url(content, :method=>:get)
%>

Fantastic - thanks to all - everything works perfectly now