allow defaults
Reported by Gaius Centus Novus | March 31st, 2008 @ 03:33 PM
I'd like to be able to change the value for @path in a Papaerclip::Attachment based on whether I'm in development, testing, or production. I could do this in my model:
has_attached_file :avatar, :path => {:production => ..., :test => ...}[ENV['RAILS_ENV']], ...
but it's not very elegant. I'd rather do this in my config/environments/xxx.rb:
Paperclip::Attachment::DEFAULTS[:path] = '...'
and not specify a path in my model unless I really want to override it.
Oddly, the outdated file_column does this the right way.
Comments and changes to this ticket
-

Gaius Centus Novus March 31st, 2008 @ 07:08 PM
this is a duplicate of #4, but that ticket has more information
-
Jon Yurek April 3rd, 2008 @ 11:25 AM
- → State changed from new to resolved
- → Assigned user changed from to Jon Yurek
I've added in defaults hash, but in a slightly different way from how you suggested. I added the hash as an accessor as Paperclip::Attachment.default_options and is available in trunk now.
-
Chris Lloyd September 12th, 2008 @ 01:28 AM
- → Tag cleared.
Just to clear up for anybody reading this (it's not obvious from the above comment), to set app wide Paperclip defaults do something like this:
Paperclip::Attachment.default_options[:path] = 'my_path'
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
