diff options
author | schneems <richard.schneeman@gmail.com> | 2012-03-20 19:28:30 -0400 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2012-03-20 20:58:50 -0400 |
commit | 0a555dd421f3b7966df1a1f70ae462a143734d21 (patch) | |
tree | 37ab7eba1d1a23ab53215e942bb4ab3f54119607 /railties/lib/rails | |
parent | b49a7ddce18a35a39fd5b3f6003d4a02cbd09b0e (diff) | |
download | rails-0a555dd421f3b7966df1a1f70ae462a143734d21.tar.gz rails-0a555dd421f3b7966df1a1f70ae462a143734d21.tar.bz2 rails-0a555dd421f3b7966df1a1f70ae462a143734d21.zip |
fix rails server support of RAILS_ENV variable
When launching rails server from the command line with a rails environment specified such as `rails server RAILS_ENV=production` an error would occur since rails will try to use `RAILS_ENV=production` as it's server.
When launching rails with a specified server such as thin `rails server thin RAILS_ENV=production` no error will be thrown, but rails will not start up in the specified environment.
This fixes both of those cases
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/commands/server.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index a608693ca4..721a47a974 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -32,6 +32,11 @@ module Rails opt_parser.parse! args + # Handle's environment like RAILS_ENV=production passed in directly + if index = args.index {|arg| arg.include?("RAILS_ENV")} + options[:environment] ||= args.delete_at(index).split('=').last + end + options[:server] = args.shift options end |