diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-05 16:26:52 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-05 16:26:52 -0800 |
commit | bdffd1e884593adc40fb30bd7c05661a668fc897 (patch) | |
tree | ea042f526542d22e1703ec2e9d2367035300f35d | |
parent | 2516a1d5c8d3d1391f56d7e8319b4e6342e6bef2 (diff) | |
parent | 732d3507da930c8d21e21d2c87c96594bb1e4d2c (diff) | |
download | rails-bdffd1e884593adc40fb30bd7c05661a668fc897.tar.gz rails-bdffd1e884593adc40fb30bd7c05661a668fc897.tar.bz2 rails-bdffd1e884593adc40fb30bd7c05661a668fc897.zip |
Merge pull request #8774 from goshakkk/multiline-block-do-end
Prefer do-end for multiline block [ci skip]
-rw-r--r-- | guides/source/initialization.md | 4 | ||||
-rw-r--r-- | guides/source/rails_on_rack.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/commands.rb | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/guides/source/initialization.md b/guides/source/initialization.md index 32df508f9c..457e28383d 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -232,13 +232,13 @@ when 'server' Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru")) require 'rails/commands/server' - Rails::Server.new.tap { |server| + Rails::Server.new.tap do |server| # We need to require application after the server sets environment, # otherwise the --environment option given to the server won't propagate. require APP_PATH Dir.chdir(Rails.application.root) server.start - } + end ``` This file will change into the root of the directory (a path two directories back from `APP_PATH` which points at `config/application.rb`), but only if the `config.ru` file isn't found. This then requires `rails/commands/server` which sets up the `Rails::Server` class. diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md index ac355b4a08..a6119eb433 100644 --- a/guides/source/rails_on_rack.md +++ b/guides/source/rails_on_rack.md @@ -37,11 +37,11 @@ Rails on Rack Here's how `rails server` creates an instance of `Rack::Server` ```ruby -Rails::Server.new.tap { |server| +Rails::Server.new.tap do |server| require APP_PATH Dir.chdir(Rails.application.root) server.start -} +end ``` The `Rails::Server` inherits from `Rack::Server` and calls the `Rack::Server#start` method this way: diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index 3ab2a3809e..5ccec8082c 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -77,13 +77,13 @@ when 'server' Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru")) require 'rails/commands/server' - Rails::Server.new.tap { |server| + Rails::Server.new.tap do |server| # We need to require application after the server sets environment, # otherwise the --environment option given to the server won't propagate. require APP_PATH Dir.chdir(Rails.application.root) server.start - } + end when 'dbconsole' require 'rails/commands/dbconsole' |