Hi, I am using paperclip to upload files. The problem I am facing is, based on my object property I need to preserve my file. Means my object should be deleted from db but the file need to be restored. I am using the option :preserve_files => true. If I keep the above option in model it will be access to all the objects of the model. I need to restore only for limited objects. for example def destroy if obj.restore_attachment Paperclip::Attachment.default_options.merge!(:preserve_files =>true) end Paperclip::Attachment.default_options.merge!(:preserve_files =>false) obj.destroy end If you observe depending on the attachment property I am setting the option. obj.restore_attachment = true obj.save For obj.destroy obj is getting deleted and file is getting restored. obj1.restore_attachment = false obj1.save For obj1.destroy obj1 is getting deleted and file is also getting restored. For obj1 this should not be happened. The file should also get deleted. Even I tried passing lambda in the model has_attached_file :attachment ,:preserve_files => lambda{|obj| obj.restore_attachment ? true : false } This also behaves as like first approach. What I observe is when we set preserve_files => true the paperclip is taking this option only through out the other requests. How to reload paperclip in the code with new options Can you please suggest any alternate solution. Cheers, Venkat. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.