rails simple_nested_form_forfields_for错误的参数数量 [英] rails simple_nested_form_for fields_for wrong number of arguments
本文介绍了rails simple_nested_form_forfields_for错误的参数数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我要使用
<%= simple_nested_form_for(@person, :url => collection_url, :html=>{:multipart => true}) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>
但是部分行中的这一行引起了问题:
but this line in the partial is causing the problem:
<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.
The controller is using the inherited resource gem.
怎么了?谢谢您的帮助.
What's wrong? Thanks for the help.
推荐答案
我遇到了同样的问题,直到我意识到gem与git上的版本已经过时了.我只是用git上的文件手动更新了gem文件,并解决了问题!
I was having the same problem until I realized the gem is out of date with the version on git. I just manually updated the gem files with the ones on git and problem fixed!
这篇关于rails simple_nested_form_forfields_for错误的参数数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文