我已经在这个问题上苦苦挣扎了几天,似乎无法弄清楚出了什么问题.我试图允许多态文件附件到Item属于模型的模型Location.我的路线定义为:
resources :locations do
resources :items
post :sort
end
resources :items do
resources :assets #model for attachments
end
Run Code Online (Sandbox Code Playgroud)
我遵循了一个关于使用carrierwave和nested_form完成此操作的教程.但是,在设置完所有内容后,在New为Item模型请求操作时出现以下错误:wrong number of arguments (4 for 3).它告诉我在该视图的第7行发生了错误:
<%= nested_form_for [@location, @item], :html => { :multipart => true } do |f| %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<%= f.fields_for :assets do |a_form| %> ### LINE 7 ####
<p>
<%= a_form.label :file …Run Code Online (Sandbox Code Playgroud)