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
@@ -103,7 +103,9 @@ def initialize(hash_or_file = self.class.source, section = nil)
self.replace hash_or_file
hash = YAML.load(
- 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
@section = section || self.class.source # so end of error says "in application.yml"

0 comments on commit a75d684

Please sign in to comment.