Global defaults for all your paperclip attachments can be defined by changing the Paperclip::Attachment.default_options Hash, this can be useful for setting your default storage settings per example so you won't have to define them in every has_attached_file definition.
Global defaults for all your paperclip attachments can be defined by changing the Paperclip::Attachment.default_options Hash, this can be useful for setting your default storage settings per example so you won't have to define them in every has_attached_file definition.
If you're using Rails 3.x you can define a Hash with default options in config/application.rb or in any of the config/environments/*.rb files on config.paperclip_defaults, these well get merged into Paperclip::Attachment.default_options as your Rails app boots. An example:
If you're using Rails you can define a Hash with default options in config/application.rb or in any of the config/environments/*.rb files on config.paperclip_defaults, these well get merged into Paperclip::Attachment.default_options as your Rails app boots. An example:
```ruby
```ruby
moduleYourApp
moduleYourApp
...
@@ -196,7 +196,7 @@ module YourApp
...
@@ -196,7 +196,7 @@ module YourApp
end
end
```
```
In earlier version of Rails you can also directly modify the Paperclip::Attachment.default_options Hash in an initializer, this method also works when you're not using Rails (and still works in Rails 3).
Another option is to directly modify the Paperclip::Attachment.default_options Hash, this method works for non-Rails applications or is an option if you prefer to place the Paperclip default settings in an initializer.
An example Rails initializer would look something like this:
An example Rails initializer would look something like this: