diff --git a/railties/lib/generators/rails/app/templates/script/rails b/railties/lib/generators/rails/app/templates/script/rails index 199fe1a6d30a99545b8ac3dc138d828270c88be9..b01d1ee183a933675fccd6858b31fd18b43440fa 100644 --- a/railties/lib/generators/rails/app/templates/script/rails +++ b/railties/lib/generators/rails/app/templates/script/rails @@ -1,5 +1,8 @@ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -ENV_PATH = File.expand_path('../../config/environment', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +ENV_PATH = File.expand_path('../../config/environment', __FILE__) +BOOT_PATH = File.expand_path('../../config/boot', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) + +require BOOT_PATH require 'rails/commands' diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index d4558be00fdee2d1ff7efa1a5e4ba9469b7175c2..6972e25b29a3a489414fc1efd77be9d56528f43d 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -30,17 +30,19 @@ require 'rails/commands/generate' when 'c', 'console' require 'rails/commands/console' - require ENV_PATH + require APP_PATH Rails::Console.start(Rails::Application) when 's', 'server' require 'rails/commands/server' + # Initialize the server first, so environment options are set server = Rails::Server.new - require ENV_PATH + require APP_PATH + Dir.chdir(Rails::Application.root) server.start when 'db', 'dbconsole' require 'rails/commands/dbconsole' - require ENV_PATH + require APP_PATH Rails::DBConsole.start(Rails::Application) when 'application' @@ -55,7 +57,7 @@ require ENV_PATH require 'rails/commands/performance/profiler' when 'plugin' - require ENV_PATH + require APP_PATH require 'rails/commands/plugin' when 'runner' require 'rails/commands/runner'