-1

I'm new to ROR and trying simple BookReview app, i see that my index action shows all metadata at the end.

Here is my controller action:

    def index
    @books = Book.all.order("created_at DESC")
  end

Here is the index.html.erb loop

<%=  @books.each do |b| %>
    <h1><%= link_to b.title, book_path(b) %></h1>
    <p>Author: <%= b.author %></p>

<% end %>

here is the output i'm getting at browser:

enter image description here

How to avoid printing those extra lines at bottom?

code_seeker
  • 112
  • 2
  • 12

1 Answers1

1
<% @books.each do |b| %>
    <h1><%= link_to b.title, book_path(b) %></h1>
    <p>Author: <%= b.author %></p>
<% end %>

remove = in <%= @books.each do |b| %>
Narasimha Reddy - Geeker
  • 3,510
  • 2
  • 18
  • 23