Skip to content

Instantly share code, notes, and snippets.

@linyiru
Forked from ashchan/gist:7251
Created September 15, 2008 03:22
Show Gist options
  • Save linyiru/10807 to your computer and use it in GitHub Desktop.
Save linyiru/10807 to your computer and use it in GitHub Desktop.
Attachment_fu: How To Delete The Original File
class Photo < ActiveRecord::Base
has_attachment options_for_attachment_fu
after_attachment_saved do |foto|
# delete original file for disk space saving
FileUtils.rm foto.full_filename if foto.parent.nil?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment