I want to allow the user to preview the posts they''re making. Easy enough to do with text and a single model. However, now I want to allow posting of (multiple) attachments per post. My models: class Post < ActiveRecord::Base has_many :attachments ... end class Attachment < ActiveRecord::Base has_attachment :content_type => :image, ........ etc..... validates_as_attachment belongs_to :post end The problem is I don''t actually want to create new records in the attachments table until the user submit the post, but I can''t use all the attachment_fu goodness to show the images in a preview unless I create the attachments first. Suggestions? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 26/01/2008, rubynuby <dearluu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I want to allow the user to preview the posts they''re making. Easy > enough to do with text and a single model. However, now I want to > allow posting of (multiple) attachments per post. My models: > > class Post < ActiveRecord::Base > has_many :attachments > ... > end > > class Attachment < ActiveRecord::Base > has_attachment :content_type => :image, > ........ etc..... > validates_as_attachment > belongs_to :post > end > > The problem is I don''t actually want to create new records in the > attachments table until the user submit the post, but I can''t use all > the attachment_fu goodness to show the images in a preview unless I > create the attachments first. Suggestions? > > Thanks in advance.I used multiple upload photos for my previous projects (using attachment_fu as well). I just made after user successfully uploaded photos either from new action method or edit action method, redirect them to edit action method that has photos "preview" of what they''ve uploaded it where there is a remove button to remove each photos and file_field to upload more photos again. -- r9 = { name: Rie!, ym: riyari3, skype: rubyninja, li: http://linkedin.com/in/ariekeren, fb: http://profile.to/ariekeren, blog: http://tinyurl.com/2bjgvn } --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks, but it sounds like you just have a Photo model, as opposed to one that belongs_to another model? my situation is a little trickier because I don''t want to create the photos until the user is sure he wants to create the post the photos belongs_to --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---