提交 1f0f05b1 编写于 作者: C Carl Lerche

Move the original config method onto AbstractController

上级 b160663b
......@@ -28,6 +28,10 @@ def descendants
@descendants ||= []
end
def config
@config ||= ActiveSupport::InheritableOptions.new(superclass < Base ? superclass.config : {})
end
# A list of all internal methods for a controller. This finds the first
# abstract superclass of a controller, and gets a list of all public
# instance methods on that abstract class. Public instance methods of
......@@ -95,6 +99,10 @@ def initialize #:nodoc:
@_formats = nil
end
def config
self.class.config
end
# Calls the action going through the entire action dispatch stack.
#
# The actual method that is called is determined by calling
......
......@@ -11,14 +11,6 @@ module ActionController
class Metal < AbstractController::Base
abstract!
def self.config
@config ||= ActiveSupport::InheritableOptions.new(superclass < Metal ? superclass.config : {})
end
def config
self.class.config
end
# :api: public
attr_internal :params, :env
......
......@@ -109,7 +109,7 @@ class BasicController
attr_accessor :request
def config
@config ||= ActiveSupport::InheritableOptions.new(ActionController::Metal.config).tap do |config|
@config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config).tap do |config|
# VIEW TODO: View tests should not require a controller
public_dir = File.expand_path("../fixtures/public", __FILE__)
config.assets_dir = public_dir
......
......@@ -5,7 +5,7 @@ class FakeController
attr_accessor :request
def config
@config ||= ActiveSupport::InheritableOptions.new(ActionController::Metal.config)
@config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册