I am using Heroku for my production environment so I need to load the paperclip files into different directories.
For development I want it to continue in the current /system default, and in production I want to pass the :path variable to a /tmp directory per Heroku.
How do I do this? Am guessing maybe set something in the environments/production.rb file as a variable for the :path but I’d like to see explicitly how to do it the right way.
Thanks.
Here is a snippet from my controller to create the model after passing the file through a multipart form:
def create
@contact = Contact.create(params[:contact])
unless @contact.vcard.path.blank?
paperclip_vcard = File.new(@contact.vcard.path)
In the model holding the attached file there’s a method you say it holds that file and some options, etc. In that method you can pass the
:pathparameter that will tell it where to save it.Now is just a matter of checking
ENV['RAILS_ENV']to find out what environment you are and set the path accordingly.