Permalink
Browse files

during initialization, raise an error that indicates that the namespa…

…ce in question is not defined in the YAML file rather than ending up with a nil object that we try to replace self with
  • Loading branch information...
1 parent 9bcaf8e commit a75d68434424c3ee244a4767179d8742ee38add5 @fallwith fallwith committed Nov 25, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/settingslogic.rb
View
@@ -103,7 +103,9 @@ def initialize(hash_or_file = self.class.source, section = nil)
self.replace hash_or_file
else
hash = YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash
- hash = hash[self.class.namespace] if self.class.namespace
+ if self.class.namespace
+ hash = hash[self.class.namespace] or raise MissingSetting, "Missing setting '#{self.class.namespace}' in #{hash_or_file}"
+ end
self.replace hash
end
@section = section || self.class.source # so end of error says "in application.yml"

0 comments on commit a75d684

Please sign in to comment.