开发者

Rails form_for with associations defined and multipart set to true not working

开发者 https://www.devze.com 2023-04-07 23:12 出处:网络
So I have one form working just fine: <%= form_for([@document, @comment]) do |f| %> And then I have another form where I need to include a Carrierwave upload that is like this:

So I have one form working just fine:

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

And then I have another form where I need to include a Carrierwave upload that is like this:

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

The first one works fine but the second one breaks by pointing to the form definition with the erro开发者_如何学编程r:

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

Any ideas? Running Rails 3.0.0 with Ruby 1.9.2p180


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


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

I believe that will fix it for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消