Displaying 1 result from an estimated 1 matches for "existing_imag".
Did you mean:
existing_image
2006 Feb 17
1
validate() with has_many association
...> ''edit'', :id => @params[:id]
end
end
painting model
has_many :images
def thumbnail=(uploaded_image)
# form has a file upload field named painting[:thumbnail]
add_image_by_size(uploaded_image, THUMBNAIL)
end
private
def add_image_by_size(file, image_size)
if existing_image = get_image_by_size(image_size) then
if existing_image.uploaded_file?(file, image_size)
existing_image.save
else
#handle the fact that it didn''t save
end
else
# a new image is being associated with the painting
image = Image.new
ima...