Is there any established way to display an image uploaded by
attachment_fu before the model with which it is associated is actually
saved? For instance, I have an Artwork model which has many images. I’d
like to allow image uploads on the new artwork form to be displayed
after they are uploaded but before the artwork is saved.
I’ve figured out some of what I want to do here, so I can be more
This create action adds each uploaded Image, then creates a thumnail of
each and stores it in the @temp_thumb_data array.
@artwork = @current_user.artworks.new params[:artwork]
params[:image_data].each do |file|
@artwork.images << Image.new( :uploaded_data => file ) if file.size
end unless not params[:image_data]
@temp_thumb_data = 
@artwork.images.each do |image|
image.with_image do |img|
@temp_thumb_data << img.thumbnail(100, 100).to_blob
However it is stored as an encoded string and can thus not simply be
displayed. The normal method would be to use send_data in another
action, but I can’t do that here because the uploaded file is not being
persisted and would not be available to the other action.