Commit a75d68434424c3ee244a4767179d8742ee38add5
1 parent
9bcaf8e0
Exists in
master
during initialization, raise an error that indicates that the namespace in quest…
…ion is not defined in the YAML file rather than ending up with a nil object that we try to replace self with
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
lib/settingslogic.rb
... | ... | @@ -103,7 +103,9 @@ class Settingslogic < Hash |
103 | 103 | self.replace hash_or_file |
104 | 104 | else |
105 | 105 | hash = YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash |
106 | - hash = hash[self.class.namespace] if self.class.namespace | |
106 | + if self.class.namespace | |
107 | + hash = hash[self.class.namespace] or raise MissingSetting, "Missing setting '#{self.class.namespace}' in #{hash_or_file}" | |
108 | + end | |
107 | 109 | self.replace hash |
108 | 110 | end |
109 | 111 | @section = section || self.class.source # so end of error says "in application.yml" | ... | ... |