Created
April 18, 2011 09:36
-
-
Save sunkencity/925082 to your computer and use it in GitHub Desktop.
Rails:: Quick and Dirty move attachments on S3 from one path to another with paperclip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Paperclip::Attachment | |
def save | |
flush_deletes | |
oldpath = @path | |
@path = '/:attachment/:id/:style/:filename' | |
puts 'patching the path...' | |
flush_writes | |
@path = oldpath | |
@dirty = false | |
true | |
end | |
end | |
Model.all.map { |p| p.attachment_name.reprocess! } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment