diff --git a/lib/settingslogic/settings.rb b/lib/settingslogic/settings.rb index 586f7cf..1febd3a 100644 --- a/lib/settingslogic/settings.rb +++ b/lib/settingslogic/settings.rb @@ -40,10 +40,13 @@ module Settingslogic root_path = defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/config/" : "" file_path = name_or_hash.is_a?(Symbol) ? "#{root_path}#{name_or_hash}.yml" : name_or_hash self.update YAML.load(ERB.new(File.read(file_path)).result).to_hash - self.update self[RAILS_ENV] if defined?(RAILS_ENV) else raise ArgumentError.new("Your settings must be a hash, a symbol representing the name of the .yml file in your config directory, or a string representing the abosolute path to your settings file.") end + if defined?(RAILS_ENV) + rails_env = self.keys.include?(RAILS_ENV) ? RAILS_ENV : RAILS_ENV.to_sym + self.update self[rails_env] if self[rails_env] + end define_settings! end -- libgit2 0.21.0