Attachment_fu: setting the default image

Hey everyone, quick question ,

how can I set the default image using attachment_fu? (this is not a
quesiton on how to use it, cause I got it working and the first image
is being set as default)

Thing is, I want the user to have the option to change the default
image to whichever he likes, currently I have this in the user_image

def default_image
  @image = UserImage.find(params[:id])
  @userimg = UserImage.find(:all, :conditions => ['parent_id is

null AND user_id=?’,@image.user_id])
@userimg.each do |daimg|
daimg.update_attributes(:default => false)
redirect_to user_url(current_user)

in the model:

def set_as_default
self.default = true

BUT this takes way too long because it re-creates every single image
and thumbnail again…

what other way can I do this ? (where the already uploaded image dont
get re-created again)

anyone ?


I have same scenario…want to let the user change an image associated
with a product as being the default.
Using a radio button. – currently, it always sets the first image
as the default.

They should be able to pick one, or change the existing default with
radio button selection.

On Nov 16 2007, 6:50 am, “[email protected][email protected]