2011-09-26 68 views
1

所以我有一个形式,工作得很好:的Rails的form_for与各协会定义和多设置为true不工作

<%= form_for([@document, @comment]) do |f| %> 

然后,我有另一种形式,我需要包括Carrierwave上传是这样的:

<%= form_for([@document, @comment]), :html => { :multipart => true } do |f| %> 

第一个工作正常,但第二个休息所指向的表单定义与错误:

undefined method `comments_path' for #<#<Class:0x0000010475dde8>:0x0000010475a440> 

有什么想法?用Ruby 1.9.2p180的运转轨道3.0.0

回答

1
<%= form_for([@document, @comment], :html => { :multipart => true }) do |f| %> 
+0

奇怪的是,我的错误与一个不被填充的不同属性有关,但是它的存在是必需的。我不知道为什么它会抱怨这个表格。不过谢谢。 – nfed

0

<%= form_for (@comment, :url => [@document, @comment], :html => {:multipart => true}) do |f| %>

我相信一定会为您解决问题。