Made the order of framework settings significant so config.action_controller.allow_concurrency can be specified before config.action_controller.fragment_cache_store, which relies on the value of the former

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2423 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-09-30 07:20:57 +00:00
parent d994b41a05
commit 735f08aca0

@ -168,12 +168,12 @@ def initialize
self.database_configuration_file = default_database_configuration_file
for framework in default_frameworks
self.send("#{framework}=", new_hash_with_method_access)
self.send("#{framework}=", OrderedOptions.new)
end
end
def database_configuration
YAML::load(ERB.new((IO.read(database_configuration_file))).result)
YAML::load(ERB.new(IO.read(database_configuration_file)).result)
end
def environment_path
@ -242,20 +242,6 @@ def default_controller_paths
def default_dependency_mechanism
:load
end
def new_hash_with_method_access
hash = Hash.new
def hash.method_missing(name, *args)
if has_key?(name)
self[name]
elsif name.to_s =~ /(.*)=$/
self[$1.to_sym] = args.first
end
end
hash
end
def default_cache_classes
false
@ -270,3 +256,36 @@ def default_whiny_nils
end
end
end
# Needs to be duplicated from Active Support since its needed before Active Support is available
class OrderedOptions < Array # :nodoc:
def []=(key, value)
key = key.to_sym
if pair = find_pair(key)
pair.pop
pair << value
else
self << [key, value]
end
end
def [](key)
pair = find_pair(key.to_sym)
pair ? pair.last : nil
end
def method_missing(name, *args)
if name.to_s =~ /(.*)=$/
self[$1.to_sym] = args.first
else
self[name]
end
end
private
def find_pair(key)
self.each { |i| return i if i.first == key }
return false
end
end