Move the original config method onto AbstractController

This commit is contained in:
Carl Lerche 2010-03-03 19:45:08 -08:00
parent b160663bd1
commit 1f0f05b10c
4 changed files with 10 additions and 10 deletions

View File

@ -28,6 +28,10 @@ module AbstractController
@descendants ||= [] @descendants ||= []
end 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 # 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 # abstract superclass of a controller, and gets a list of all public
# instance methods on that abstract class. Public instance methods of # instance methods on that abstract class. Public instance methods of
@ -95,6 +99,10 @@ module AbstractController
@_formats = nil @_formats = nil
end end
def config
self.class.config
end
# Calls the action going through the entire action dispatch stack. # Calls the action going through the entire action dispatch stack.
# #
# The actual method that is called is determined by calling # The actual method that is called is determined by calling

View File

@ -11,14 +11,6 @@ module ActionController
class Metal < AbstractController::Base class Metal < AbstractController::Base
abstract! abstract!
def self.config
@config ||= ActiveSupport::InheritableOptions.new(superclass < Metal ? superclass.config : {})
end
def config
self.class.config
end
# :api: public # :api: public
attr_internal :params, :env attr_internal :params, :env

View File

@ -109,7 +109,7 @@ class BasicController
attr_accessor :request attr_accessor :request
def config 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 # VIEW TODO: View tests should not require a controller
public_dir = File.expand_path("../fixtures/public", __FILE__) public_dir = File.expand_path("../fixtures/public", __FILE__)
config.assets_dir = public_dir config.assets_dir = public_dir

View File

@ -5,7 +5,7 @@ class FakeController
attr_accessor :request attr_accessor :request
def config def config
@config ||= ActiveSupport::InheritableOptions.new(ActionController::Metal.config) @config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config)
end end
end end