Take the 2-minute tour ×

I am getting this output when I got to the /projects, which should just list projects and an associated link:

Projects index

I cannot figure out why all the information from the projects table is being dumped after the list.

Controller index method:

def index
  @projects = Project.all


<%= @projects.each do |project| %>
    <%= link_to project.title, projects_path(project) %>
    <%= link_to project.link, project.link %>
<% end %>

Any ideas to why this is happening?

Thanks for reading!

share|improve this question
Can you share the code of your Project model please ? –  damienbrz Feb 21 '13 at 22:16

1 Answer 1

up vote 2 down vote accepted

Change the <%= on your loop to <%:

<% @projects.each do |project| %>

What it's doing now is executing the loop and printing all your li elements, and then also printing the contents of @projects (because of the <%=).

share|improve this answer

Your Answer


