Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit a75d68434424c3ee244a4767179d8742ee38add5 1 parent 9bcaf8e
@fallwith fallwith authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/settingslogic.rb
View
4 lib/settingslogic.rb
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.