我正在使用基本的脚手架结构。我需要的是通过更改published
为true
. 在我的想法中,在moderate.html 上,我应该获得所有未发布条目的列表,并且能够更改和保存它们的参数。以下是我的部分代码:
#names_controller.rb
def moderate
@name = Name.find(:all, :conditions => {:published => false} )
respond_to do |format|
format.html
format.xml
end
end
#moderate.html.erb
<% form_for @name.each do |f| %>
<%= f.error_messages %>
<%= f.text_field :which %>
<%= f.text_field :what %>
<%= f.check_box :published %>
<%= f.submit %>
</p>
<% end %>
相反,我收到了这个错误:
NoMethodError in Names#moderate
Showing app/views/names/moderate.html.erb where line #1 raised:
undefined method `enumerable_enumerator_path' for #<ActionView::Base:0x1042c3e90>
Extracted source (around line #1)
那么,你能帮助新手吗?
ruby 1.8.7 (2009-06-12 补丁级别 174)
[通用-darwin10.0] Rails 2.3.5