I’m using rails 3 and I would like to set the storage variable based on the current environment, like below:
#if enviroment = development or test
:storage => :filesystem,
#else
:storage => :s3,
#end
What would your approach be? I’ve thought about setting an environment variable, but I think that there must be a better way.
Thanks for your time
Simone
One way to do this is use the built-in environment setup in rails. The variables set in the environments directory will override the config/environment
config/environment.rb
config/environments/production.rb
Then later in your app, just ask ATTACHMENT_OPTIONS[:storage] — no if/else throughout your app.