To work out what is going on in these situations it is often worth
while to fiddle with what you have and see what happens. For example
what if you try
<li>A <%=location.name%> B
<%=location.name%> C <%=location.name%> D <%=location.name%> E</li>
Also look at the generated html (View > Page Source or similar in the
browser) to see what is there.
Could you please quote the previous message so that it easier to
follow the thread. Remember this is a mailing list not a forum
(though you may be accessing it through a forum interface).
If you did not have the each loop round it then what was setting up location?
Could you please quote the previous message so that it easier to
follow the thread. Remember this is a mailing list not a forum
(though you may be accessing it through a forum interface).
If you did not have the each loop round it then what was setting up
location?
To work out what is going on in these situations it is often worth
while to fiddle with what you have and see what happens. For example
what if you try
<li>A <%=location.name%> B
<%=location.name%> C <%=location.name%> D <%=location.name%> E</li>
Also look at the generated html (View > Page Source or similar in the
browser) to see what is there.
Colin
Colin, I already tried that
It's only outputting A and nothing else.
but if I change to.
<% @locations.each do |location| %>
<li>A <%=location.name%> B
<%=location.name%> C <%=location.name%> D <%=location.name%> E</li>
<% end %>
Try to be more specific with old versions of Rails and change
<%= render(@locations) %>
to
<%= render :partial => "location/location", :collection => @locations
%>
In this case _location partial should have local variable "location"
correctly set.