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?
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) %>
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)
%>
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