mongoid-paperclip icon indicating copy to clipboard operation
mongoid-paperclip copied to clipboard

embeds_many and paperclip

Open patricklehmann opened this issue 11 years ago • 1 comments

I upload a file with the nested_form_for and the params are really stored in the database. The file itself is not stored on the filesystem.

What does not work:

class Video < Product embeds_many :thumbnails

class Thumbnail include Mongoid::Paperclip has_mongoid_attached_file :file embedded_in :product

What does work: class Video < Product has_many :thumbnails

class Thumbnail include Mongoid::Paperclip has_mongoid_attached_file :file belongs_to :product

Can somebody helps me? Because i don't want to store the thumbnails in a own collection.

patricklehmann avatar Aug 07 '13 15:08 patricklehmann

There still seems to be a problem if you use an embedded model. I switched from embeds_many to has_many and afterwords it worked.

If you use embeds_many the object is stored and the images are processed. But no images apear in the public folder.

mike-petersen avatar Jun 15 '17 16:06 mike-petersen