所以我在Rails 3.1中使用
<%= simple_nested_form_for(@person, :url => collection_url, :html=>{:multipart => true}) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>
但是部分行中的此行导致了问题:
<h2>Badges</h2>
<ul id="certifications">
// this following line is raising the error "wrong number of arguments (4 for 3)"
<%= f.fields_for :certifications do |certification_form| %>
<%= render :partial => 'certification', :locals => { :f => certification_form } %>
<% end %>
</ul>
<%= f.link_to_add "Add a Badge", :certifications %>
所以这是模型:
class Person < ActiveRecord::Base
has_many :certifications, :dependent=>:destroy, :order=>:position
has_many :certificates, :through=>:certifications
accepts_nested_attributes_for :certifications, :allow_destroy => true
end
控制器正在使用继承的资源gem。
怎么了?谢谢您的帮助。
最佳答案
我遇到了同样的问题,直到我意识到gem与git上的版本已过时。我只是用git上的文件手动更新了gem文件,并解决了问题!