Skip to content

Instantly share code, notes, and snippets.

@scottmessinger
Created August 23, 2011 17:03
Show Gist options
  • Save scottmessinger/1165871 to your computer and use it in GitHub Desktop.
Save scottmessinger/1165871 to your computer and use it in GitHub Desktop.
Monkeypatching a Gem
# utilities > carrierwave > storage > fog.rb
# utilities is in my autoload path
# after this, carrierwave ceased to work. I commented out the method, still nothing.
# it appears that the class completely clobbers the existing class....
module CarrierWave
module Storage
class Fog < Abstract
class File
def rename_file(name)
connection.copy(bucket, @path, bucket, @path, directive=:replace, "content-disposition" => "attachment; filename = #{name}")
end
end
end # Fog
end # Storage
end # CarrierWave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment