奇怪的危险行为:自动打印所有 table 内容
Strange dangerous behaviour: Printing all table contents automatically
我在我的项目中使用 PaperClip gem。
index.html.erb:
<h1 class="current-category">
<%= params[:category] %></h1>
<% if @books.count == 0 %>
<h1>There are no books in this category</h1>
<%else%>
<div class="row">
<%= @books.each do |book| %>
<div class="col-md-3">
<a href="/books/<%= book.id %>" >
<%= image_tag book.book_img.url(:book_index), class: "book" %>
</a>
</div>
<% end %>
</div>
<%end%>
问题是 index.html.erb 显示了所有图像以及 Book 数据库的全部内容。
我正在添加下面的屏幕截图。这似乎是回形针 gem 中的一个错误。或者我犯了什么错误?
从下一行中删除 =
。
<% @books.each do |book| %>
我在我的项目中使用 PaperClip gem。
index.html.erb:
<h1 class="current-category">
<%= params[:category] %></h1>
<% if @books.count == 0 %>
<h1>There are no books in this category</h1>
<%else%>
<div class="row">
<%= @books.each do |book| %>
<div class="col-md-3">
<a href="/books/<%= book.id %>" >
<%= image_tag book.book_img.url(:book_index), class: "book" %>
</a>
</div>
<% end %>
</div>
<%end%>
问题是 index.html.erb 显示了所有图像以及 Book 数据库的全部内容。
我正在添加下面的屏幕截图。这似乎是回形针 gem 中的一个错误。或者我犯了什么错误?
从下一行中删除 =
。
<% @books.each do |book| %>