Webrick: does it honour ENV['RAILS_ENV'] ||= 'production'

my environment.rb contains
ENV[‘RAILS_ENV’] ||= ‘production’

when i start webrick with command
ruby script\server

it still runs in development mode. Is this expected behavior of
webrick?? why?

the only way to run webrick in peoduction mode,it seems, is by :-
ruby script\server -e production

The ||= operator indicates that if RAILS_ENV isn’t already set, then
Ruby should set it (in this case, to ‘production’). I’m willing to
bet that WEBrick sets it to development before it gets to that line
environment.rb. Try changing ||= to = (I don’t know if that will
work).

–Jeremy

On 11/14/07, Jigar G. [email protected] wrote:

the only way to run webrick in peoduction mode,it seems, is by :-
ruby script\server -e production

Posted via http://www.ruby-forum.com/.


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book

My blogs:

http://www.rubyinpractice.com/

thanks for reply, it was thoughtful

But alas,

ENV[‘RAILS_ENV’] = ‘production’

doesn’t work either.

I think I’ll stick to -e production

Jeremy McAnally wrote:

The ||= operator indicates that if RAILS_ENV isn’t already set, then
Ruby should set it (in this case, to ‘production’). I’m willing to
bet that WEBrick sets it to development before it gets to that line
environment.rb. Try changing ||= to = (I don’t know if that will
work).

–Jeremy

On 11/14/07, Jigar G. [email protected] wrote:

the only way to run webrick in peoduction mode,it seems, is by :-
ruby script\server -e production

Posted via http://www.ruby-forum.com/.


http://www.jeremymcanally.com/

My books:
Ruby in Practice
Ruby in Practice

My free Ruby e-book
http://www.humblelittlerubybook.com/

My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/