Skip to content

Commit

Permalink
config.ru uses the effective Rack app
Browse files Browse the repository at this point in the history
We used to pass the Rails::Application subclass to #run.
The Rails server then called #to_app to convert that class to the
actual Rack application.

if you surround `#run` with a call to `#map` the server no longer
convertes the class to the instance and we end up with unnecessary
delegation calls on every request.
  • Loading branch information
senny committed Mar 15, 2013
1 parent 5558bb0 commit 9b5c085
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions railties/lib/rails/commands/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def initialize(*)
set_environment
end

# TODO: this is no longer required but we keep it for the moment to support older config.ru files.
def app
@app ||= begin
app = super
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
run <%= app_const %>
run Rails.application

0 comments on commit 9b5c085

Please sign in to comment.