aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/server
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-01-20 16:11:10 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-08-08 07:47:11 +0900
commitf2173648938b418d120f5a68d8f3862d8ae9dace (patch)
tree189ab54e40d4b3d3f861c0c58b3d332cd07f918a /railties/lib/rails/commands/server
parent6b0d59895ccaf81767a0243eb166d59a36e1ab5a (diff)
downloadrails-f2173648938b418d120f5a68d8f3862d8ae9dace.tar.gz
rails-f2173648938b418d120f5a68d8f3862d8ae9dace.tar.bz2
rails-f2173648938b418d120f5a68d8f3862d8ae9dace.zip
Deprecate support of older `config.ru`
Since Rails 4.0, `config.ru` generated by default uses instances of `Rails.application`. Therefore, I think that it is good to deprecate the old behavior. Related: #9669
Diffstat (limited to 'railties/lib/rails/commands/server')
-rw-r--r--railties/lib/rails/commands/server/server_command.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb
index ce258341f6..de69b4586b 100644
--- a/railties/lib/rails/commands/server/server_command.rb
+++ b/railties/lib/rails/commands/server/server_command.rb
@@ -2,6 +2,8 @@ require "fileutils"
require "optparse"
require "action_dispatch"
require "rails"
+require "active_support/deprecation"
+require "active_support/core_ext/string/filters"
require_relative "../../dev_caching"
module Rails
@@ -18,10 +20,15 @@ module Rails
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
+ if app.is_a?(Class)
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
+ Use `Rails::Application` subclass to start the server is deprecated and will be removed in Rails 6.0.
+ Please change `run #{app}` to `run Rails.application` in config.ru.
+ MSG
+ end
app.respond_to?(:to_app) ? app.to_app : app
end
end