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? -- Posted via http://www.ruby-forum.com/.
On 7/31/06, Erwann <erwann212@gmail.com> 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 Muermann wrote:> On 7/31/06, Erwann <erwann212@gmail.com> > 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.Note that you can also use the RAILS_ROOT constant. This is defined to be the directory that contains your Rails application. -- Philip Ross http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby