Not sure what's going on here, but I think my nested forms partially caused a problem for CarrierWave.
When I update the field with the downloaded file, nothing happens: there is no error, but nothing is saved.
I have a Household model with a has_many relationship with an Individuals model. The "Independent" model has a "pictures" downloader:
class Individual < ActiveRecord::Base belongs_to :household mount_uploader :picture, PictureUploader end
In my views, I:
= form_for @household, :html => {:multipart => true} do |f|
and then call partial for individuals:
= f.fields_for :individuals do |builder| = render 'individual_fields', :f => builder = f.submit
Partial just has the following:
= f.label :firstname, 'First' = f.text_field :firstname, :size => 10 = f.label :lastname, 'Last' = f.text_field :lastname, :size => 15 = f.file_field :picture
The loaded image appears in the options:
Started POST "/households/849" for 127.0.0.1 at 2011-02-15 15:45:16 -0500 Processing by HouseholdsController#update as HTML Parameters: {"...6/1/2008; Active 6/6", "individuals_attributes"=>{"0"=>{"firstname"=>"Hannah", ... "picture"=>#<ActionDispatch::Http::UploadedFile:0xb9fbd24 @original_filename="3.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"household[individuals_attributes][1][picture]\"; filename=\"3.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20110215-6498-ba4bp>>, "_destroy"=>"false", "id"=>"4077"}}}, "commit"=>"Update Household", "id"=>"849"}
And it is saved in the tmp directory in the boot path. It was never stored in the database and was not included in the file system.
Any ideas?
ruby-on-rails ruby-on-rails-3
thermans
source share