It does seem like a bad idea to have it hardcoded to development in initializer.rb.
I've never run into your problem, though. quick fix: set RAILS_ENV to the appropriate value in your system wide bashrc on staging and production machines. even easier with stuff like puppet and chef. -B.A. On Oct 13, 2009, at 12:09 PM, John Trupiano wrote: > +1 I've had similar problems. > > -John > > On Tue, Oct 13, 2009 at 12:53 PM, Mislav Marohnić <mislav.maroh...@gmail.co > m> wrote: > The default value for RAILS_ENV is set to "development" in > initializer.rb, which is loaded right after boot.rb has determined > the boot strategy. > > I created a "config/preinitializer.rb" which was supposed to provide > another default value for RAILS_ENV ("staging" or "production", > depending on the host), but it doesn't work in all cases. > Specifically, commands executed by "console", "dbconsole", "runner" > and "server" scripts all set RAILS_ENV to "development" as default > and ruins my preinitializer idea since these scripts happen before > the actual initialization phase. > > The workaround right now is to hardcode the RAILS_ENV value in > preinitializer.rb without respecting the ENV["RAILS_ENV"] variable, > but that disables the possiblity that I actually start the app in > some custom environment other than what I wanted to hardcode for > this host. > > What I would like to do is remove the "development" default from > script/console, script/runner and script/server (removing it from > "dbconsole" is not possible since it doesn't load the environment) > and unless anyone can find an objection to this, I will be posting a > patch. > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---