Previewing a post with an attachment_fu image

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.

On 26/01/2008, rubynuby [email protected] wrote:

    has_attachment :content_type => :image,

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 }

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs