I am working in a Rails Project and my problem is that for some reason the home view shows the SQL Query next to the book image. Here is the HTML code that shows the index view
<div id="books-index">
<% @books.each_slice(4) do |book| %>
<div class="row">
<%= book.each do |book| %>
<div class="col-md-3 col-sm-3">
<h3><%= book.title %></h3>
<%= image_tag(book.coverpath) %>
<%= link_to 'Read More', book_path(book), class:"btn btn-primary" %>
</div>
<% end %>
</div>
<% end %>
</div>
and the books controller
class BooksController < ApplicationController
def new
@page_title = 'Add Book'
@book = Book.new
@category = Category.new
@author = Author.new
@publisher = Publisher.new
end
def create
@book = Book.new(book_params)
if @book.save
flash[:notice] = "Book Created"
redirect_to books_path
else
render 'new'
end
end
def index
@books = Book.all
end
private
def book_params
params.require(:book).permit(:title, :category_id, :author_id, :publisher_id, :isbn, :price, :buy, :format, :excerpt, :pages, :year, :coverpath)
end
end
Thanks a lot for your help