提交 bdffd1e8 编写于 作者: C Carlos Antonio da Silva

Merge pull request #8774 from goshakkk/multiline-block-do-end

Prefer do-end for multiline block [ci skip]
......@@ -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.
......
......@@ -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:
......
......@@ -77,13 +77,13 @@
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'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册