Skip to content

Commit 127c9e3

Browse files
committed
Using Rails.env instead of RAILS_ENV constant
1 parent 135103b commit 127c9e3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/jammit.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ def self.load_configuration(config_path, soft=false)
6666
conf = YAML.load(ERB.new(File.read(config_path)).result)
6767

6868
# Optionally overwrite configurations based on the environment
69-
if conf.has_key?(RAILS_ENV) && conf[RAILS_ENV].is_a?(Hash)
70-
conf.merge!(conf.delete(RAILS_ENV))
69+
rails_env = defined?(Rails) ? Rails.env : RAILS_ENV
70+
if conf.has_key?(rails_env) && conf[rails_env].is_a?(Hash)
71+
conf.merge!(conf.delete(rails_env))
7172
end
7273

7374
@config_path = config_path

0 commit comments

Comments
 (0)