Rails -v 3.2.3
我试图在我不断得到的视图中显示表格内的链接
NoMethodError in Links#submissions , views/links/submissions.html.erb where line #10 raised: undefined method "each" for nil:NilClass
这是我的submission.htm.erb
<table>
<% @links.each do |link| %>
<tr valign = "top">
<td>
<%= link_to_remote "Up",
:url => { :action => 'modify_points',
:id => link.id,
:by => 1 },
:update => "link" + link.id.to_s %>
</td>
<td>
<%= link_to_remote "Down",
:url => { :action => 'modify_points',
:id => link.id,
:by => -1 },
:update => "link" + link.id.to_s %>
</td>
<td>
<b> <a href="<%= link.url %>"> <%= link.description %> </a> </b>
(<%= if link.url =~ /(:\/\/) ([^\/]*)/ then $2 else "wrong URL" end %>) <br/>
<span id="link"><%= link.id.to_s %>"%><%= link.points %> </span>
points posted <%= time_ago_in_words link.created_at %> ago
</td>
</tr>
<% end %>
</table>
我的问题是....如果没有链接,我是否需要编写一些代码?这就是我收到此错误消息的原因吗?