Rails diff model config in dev or prod environment

Posted by Denis on Stack Overflow See other posts from Stack Overflow or by Denis
Published on 2010-03-28T14:55:48Z Indexed on 2010/03/28 15:03 UTC
Read the original article Hit count: 241

Filed under:

Hi,

I've a model which use paperclip, in dev env I want to store files on the file system.

In production I want to store them on my s3 account.

How to configure my model to reflet this difference?

Here is my model

class Photo < ActiveRecord::Base
  has_attached_file :photo, :styles => { :medium => "200x200>", :thumb => "100x100>" },
                    :storage => :s3, 
                    :s3_credentials => "#{Rails.root}/config/s3.yml", 
                    :path => "/:style/:filename"
end

© Stack Overflow or respective owner

Related posts about ruby-on-rails