【发布时间】:2015-10-27 20:50:08
【问题描述】:
失败了。一个人可以有多个出价,这个特定的人只有一个出价。
在我的索引操作中,我有 @bids = Bid.find_by_person_id(params[:person_id])
在我看来是这样的
<% @bids.each do |bid| %>
<%= bid.bid_amount %>
<% end %>
在访问人员出价的索引视图时,我收到了NoMethodError: undefined method each' for #<Bid:0x007f988a346f00>。
这是因为这个人只有一个出价吗?我觉得不是这样,但除此之外我很茫然..
【问题讨论】:
-
我知道它不是零。我调试验证。
-
你不能遍历一条记录我的朋友
标签: ruby-on-rails ruby activerecord