From 0a555dd421f3b7966df1a1f70ae462a143734d21 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 20 Mar 2012 19:28:30 -0400 Subject: 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 --- railties/lib/rails/commands/server.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'railties/lib/rails/commands/server.rb') 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 -- cgit v1.2.3