mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Delegate App calls to instance
This commit is contained in:
parent
d618b7e3dc
commit
2db14457f4
5 changed files with 11 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
# This file is used by Rack-based servers to start the application.
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
require ::File.expand_path('../config/environment', __FILE__)
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
run <%= app_const %>.instance
|
run <%= app_const %>
|
||||||
|
|
|
@ -2,4 +2,4 @@ require File.expand_path('../../config/boot', __FILE__)
|
||||||
require 'rails/commands/console'
|
require 'rails/commands/console'
|
||||||
require File.expand_path('../../config/application', __FILE__)
|
require File.expand_path('../../config/application', __FILE__)
|
||||||
|
|
||||||
Rails::Console.start(<%= app_const %>.instance)
|
Rails::Console.start(<%= app_const %>)
|
||||||
|
|
|
@ -2,4 +2,4 @@ require File.expand_path('../../config/boot', __FILE__)
|
||||||
require 'rails/commands/dbconsole'
|
require 'rails/commands/dbconsole'
|
||||||
require File.expand_path('../../config/application', __FILE__)
|
require File.expand_path('../../config/application', __FILE__)
|
||||||
|
|
||||||
Rails::DBConsole.start(<%= app_const %>.instance)
|
Rails::DBConsole.start(<%= app_const %>)
|
||||||
|
|
|
@ -8,7 +8,13 @@ module Rails
|
||||||
class << self
|
class << self
|
||||||
attr_writer :config
|
attr_writer :config
|
||||||
alias configure class_eval
|
alias configure class_eval
|
||||||
delegate :initialize!, :load_tasks, :load_generators, :root, :to => :instance
|
delegate :call,
|
||||||
|
:initialize!,
|
||||||
|
:load_generators,
|
||||||
|
:load_tasks,
|
||||||
|
:middleware,
|
||||||
|
:root,
|
||||||
|
:to => :instance
|
||||||
|
|
||||||
private :new
|
private :new
|
||||||
def instance
|
def instance
|
||||||
|
|
|
@ -76,7 +76,7 @@ module ApplicationTests
|
||||||
end
|
end
|
||||||
|
|
||||||
def middleware
|
def middleware
|
||||||
AppTemplate::Application.instance.middleware.active.map(&:klass).map(&:name)
|
AppTemplate::Application.middleware.active.map(&:klass).map(&:name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue