Ebad Saghar
Ebad Saghar

Reputation: 1127

Getting extra information when looping in Ruby

I'm using the each do loop correctly, and not getting errors when looping an active record base. But for some reason, I am getting extra information at the end.

Here's what my controller looks like:

def archivedBlogs
    @compsci = Compsci.all
    @personalb = Personalb.all
end

And here is the code I have in the view page:

<div class="panel">
  <ul>
    <%= @compsci.each do |blog| %>
    <li><%= blog.title %></li>
    <% end %>
  </ul>
</div>

But as you can see, I'm getting extra stuff at the end:

enter image description here

How can I fix it so that it only prints the blog titles?

Upvotes: 1

Views: 45

Answers (1)

spickermann
spickermann

Reputation: 106792

Change

<%= @compsci.each do |blog| %>

to

<% @compsci.each do |blog| %>

Upvotes: 4

Related Questions