Hi I''m using attribute_fu and paperclip to add multiple images to a specific record. This is working great when creating a new record but when I want to add new images to an existing record through a common scaffold update, the images upload but replace the existing images. Any thoughts or advice? Thank''s -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 19, 2010, at 10:20 AM, Patrice Cartier wrote:> Hi > > I''m using attribute_fu and paperclip to add multiple images to a > specific record. > > This is working great when creating a new record but when I want to > add > new images to an existing record through a common scaffold update, the > images upload but replace the existing images.Do you have a separate model to hold the additional images? Or do you have N number of image "slots" per record? Paperclip manages each image as a virtual attribute of your model, and if you upload a new image in the same slot, that image will overwrite the previous one. Unless you''re adding has_attached_image :image1 has_attached_image :image2 ... and all the paperclip-specific fields that go with them, you are probably ending up with a single field to hold your images. I''m not familiar with attribute_fu -- does that somehow work around this problem? Walter -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Davis wrote in post #955464:> On Oct 19, 2010, at 10:20 AM, Patrice Cartier wrote: > >> Hi >> >> I''m using attribute_fu and paperclip to add multiple images to a >> specific record. >> >> This is working great when creating a new record but when I want to >> add >> new images to an existing record through a common scaffold update, the >> images upload but replace the existing images. > > Do you have a separate model to hold the additional images? Or do you > have N number of image "slots" per record? Paperclip manages each > image as a virtual attribute of your model, and if you upload a new > image in the same slot, that image will overwrite the previous one. > Unless you''re adding > > has_attached_image :image1 > has_attached_image :image2 > ... > > and all the paperclip-specific fields that go with them, you are > probably ending up with a single field to hold your images. > > I''m not familiar with attribute_fu -- does that somehow work around > this problem? > > WalterHi Walter, I follow this tuto : http://www.mfischer.com/wordpress/2009/02/02/multiple-image-upload-and-crop-with-rails/ without the cropping part. Also, this problem came when i upgrade my app to 2.3.5 because before it was working find… I don''t find the solution… -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oh, ok. You are ending up with something that is now native to Rails. Attribute_fu seems to be doing what accepts_nested_attributes_for does now. I suspect you can refactor your application to remove that plug- in and move ahead. Nested forms came into being somewhere in the 2.3 timeframe, so you might want to find a different tutorial that is more up to date. There''s an excellent Railscast about them. You are in fact doing what I thought you needed to -- you have a separate model for your images, and so you can have N number of them related to a single parent model. Walter On Oct 19, 2010, at 11:32 AM, Patrice Cartier wrote:> Walter Davis wrote in post #955464: >> On Oct 19, 2010, at 10:20 AM, Patrice Cartier wrote: >> >>> Hi >>> >>> I''m using attribute_fu and paperclip to add multiple images to a >>> specific record. >>> >>> This is working great when creating a new record but when I want to >>> add >>> new images to an existing record through a common scaffold update, >>> the >>> images upload but replace the existing images. >> >> Do you have a separate model to hold the additional images? Or do you >> have N number of image "slots" per record? Paperclip manages each >> image as a virtual attribute of your model, and if you upload a new >> image in the same slot, that image will overwrite the previous one. >> Unless you''re adding >> >> has_attached_image :image1 >> has_attached_image :image2 >> ... >> >> and all the paperclip-specific fields that go with them, you are >> probably ending up with a single field to hold your images. >> >> I''m not familiar with attribute_fu -- does that somehow work around >> this problem? >> >> Walter > > Hi Walter, > > I follow this tuto : > http://www.mfischer.com/wordpress/2009/02/02/multiple-image-upload-and-crop-with-rails/ > > without the cropping part. > > Also, this problem came when i upgrade my app to 2.3.5 because > before it > was working find… > > I don''t find the solution… > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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 rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Walter, I''d found the problem. my model upload has article_id, description, photo_filenane In my partial: _upload.rhtml if i just put: <div class="upload"> <%= f.file_field :photo %> <%= f.remove_link "remove" %> </div> when i update, it delete my photos. but if i put: <div class="upload"> <%= f.text_field :description %> <%= f.file_field :photo %> <%= f.remove_link "remove" %> </div> it works fine… Strange… Anyway, thanks! -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.