Listing articles
[#<Article id: 1, title: "kiran", text: "kumarafadfadf", created_at: "2018-02-11 12:04:41", updated_at: "2018-02-11 12:04:41">, #<Article id: 2, title: "Ruby ", text: "Rails is awesome framework", created_at: "2018-02-11 12:32:01", updated_at: "2018-02-11 12:32:01">, #<Article id: 3, title: "Santhi", text: "I love you", created_at: "2018-02-11 12:33:26", updated_at: "2018-02-13 04:50:11">, #<Article id: 4, title: "Ruby ", text: "Ruby on rails", created_at: "2018-02-13 04:05:51", updated_at: "2018-02-13 04:05:51">, #<Article id: 5, title: "Rails ", text: "Welcome to Rails", created_at: "2018-02-13 04:10:31", updated_at: "2018-02-13 04:10:31">, #<Article id: 6, title: "adfa", text: "adfadfadf", created_at: "2018-02-13 04:14:14", updated_at: "2018-02-13 04:14:14">, #<Article id: 7, title: "", text: "", created_at: "2018-02-13 04:33:21", updated_at: "2018-02-13 04:33:21">]
Title Text
Rankin rails5 show new edit
Ruby Rails is awesome framework show new edit
ruby I love you show new edit
Ruby Ruby on rails show new edit
Rails Welcome to Rails show new edit
index.html.erb
<h1>Listing articles</h1>
<table>
<tr>
<th>Title</th>
<th>Text</th>
</tr>
<%= @articles.each do |article| %>
<tr>
<td><%= article.title %></td>
<td><%= article.text %></td>
<td><%= link_to 'show', article_path(article) %></td>
<td><%= link_to 'new', new_article_path %></td>
<td><%= link_to'edit', edit_article_path(article) %></td>
</tr>
<% end %>
</table>
我只需要显示文章列表。我怎么能在这里删除数组。这里我只显示不包含数组的文章列表。
提前致谢
答案 0 :(得分:0)
<%= @articles.each do |article| %>
应该是
<% @articles.each do |article| %>