I have two models, one model girl and one girl_photos (a file upload
asset). The only code I have in models which describes the association
For the girl => belongs_to :girl and has_attached_file :photo
For the model girl_photos => has_many :girl_photos and
I've tried to save as a nested attribute the photo, it saves the
association in the database but it doesn't set the name of the image
and doesn't upload it.
I thought that it might be a problem with paperclip so I created
another test model with no association, just one image upload (in the
same model) and it worked fine (it uploaded the images and saved it
In the log file I see the following:
INSERT INTO `girls` (`name`, `surname`, `height`, `weight`,
`description`, `created_at`, `updated_at`) VALUES ('test', 'test',
'test', 'test', 'test', '2011-05-27 18:31:57', '2011-05-27 18:31:57')
INSERT INTO `girl_photos` (`created_at`, `updated_at`,
`photo_file_name`, `photo_content_type`, `photo_file_size`,
`photo_updated_at`, `girl_id`) VALUES ('2011-05-27 18:31:57',
'2011-05-27 18:31:57', NULL, NULL, NULL, NULL, 4)
[paperclip] Saving attachments.
For some reason, on the second query, it saves the photo but it
doesn't captures the name and it doesn't upload it. I don't know what
else could I try or test.
Thank you for your help.