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
controller:
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)
end
@image.set_as_default
redirect_to user_url(current_user)
end
in the model:
def set_as_default
self.default = true
self.save
end
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)