Where to store filesystem path?

Hello,

My app needs to know where to store files but the path is different for
dev and production. What is the best way to do it?

  • something like $path = ‘/home/myrailsapp/public/files/’ in
    development.rb and $path = ‘/home/my_remote_prod_sapp/public/files/’ in
    production.rb?

  • do a test to check the env and add the path in application.rb?

  • do a test to check the env and add the path in the model files?

  • something clever?

On 7/31/06, Erwann [email protected] wrote:

Hello,

My app needs to know where to store files but the path is different for
dev and production. What is the best way to do it?

  • something like $path = ‘/home/myrailsapp/public/files/’ in
    development.rb and $path = ‘/home/my_remote_prod_sapp/public/files/’ in
    production.rb?

Most certainly this one. It’s an environment-specific configuration
and should be treated as such.

Max

Max M. wrote:

Most certainly this one. It’s an environment-specific configuration
and should be treated as such.

Note that you can also use the RAILS_ROOT constant. This is defined to
be the directory that contains your Rails application.


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby

thanks, That was so simple!