this is what is generated by the form. I separated the lines at
'Image 1' which is the value I entered in for the Image description
but it shows NULL for the image attributes (image_file_name, etc)
Processing AnalysesController#create (for 127.0.0.1 at 2010-03-31
09:26:53) [POST]
Parameters: {"authenticity_token"=>"WuQMc
+ntdX84NSUnXwRbjCXqdSQ0AMAK6VrsxUvv5kQ=",
"analysis"=>{"author"=>"Author 1",
"photo_attributes"=>[{"description"=>"Image 1",
"image"=>"IMG_3132.JPG"}, {"description"=>"", "image"=>""},
{"description"=>"", "image"=>""}]}, "commit"=>"Create"}
Analysis Columns (2.3ms) SHOW FIELDS FROM `analyses`
Photo Columns (1.6ms) SHOW FIELDS FROM `photos`
SQL (0.2ms) BEGIN
Analysis Create (0.7ms) INSERT INTO `analyses` (`problematik`,
`comment`, `technique`, `samplenbr`, `ref`, `worknbr`, `date`,
`author`, `record`, `created_at`, `updated_at`, `images`) VALUES(NULL,
NULL, NULL, '', '', '', NULL, 'Author 1', 0, '2010-03-31 07:26:53',
'2010-03-31 07:26:53', NULL)
Photo Create (0.4ms) INSERT INTO `photos` (`description`,
`author`, `created_at`, `updated_at`, `image_file_name`,
`image_content_type`, `image_file_size`, `image_updated_at`,
`analysis_id`) VALUES
('Image 1',
NULL, '2010-03-31 07:26:53', '2010-03-31 07:26:53', NULL, NULL, NULL,
NULL, 14)
On Mar 31, 9:03 am, Marcin Seroczynski <[email protected]> wrote:
> Hello,
>
> Could You post what is generated by the form?
>
> Paperclip is enough smart with mass saving and when he has
> params[:model][:image] poiting to Your file through file_field :image
> it should just grab the file (from Rack TMP) and save it as a image.
>
> Best,
> Martin
>
> On Mar 30, 7:15 pm, ES <[email protected]> wrote:
>
> > I have an object that has multiple photos uploaded to it, using the
> > paperclip plugin. I used a virtual attribute to have mutliple photos
> > in the form but I can't figure out how to get the image to save. It
> > works if I put <%= photo_form.file_field :image_file_name %> instead
> > of just :image. If I use just the following, the image_file_name
> > field is blank when it is saved.
>
> > <% for photo in @analysis.photos %>
> > <% fields_for "analysis[photo_attributes][]", photo do |photo_form|
> > %>
> > <p>
> > image description: <%= photo_form.text_field :description %>
> > <%= photo_form.file_field :image %>
> > </p>
> > <% end %>
> > <% end %>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.