0

I would like to call value of setting.yml in config/initializers/refile.rb So I try to set it as follows.But it Does not work as I thought.

When I run SPEC file, the value of Refile.cdn_host is empty. I don't know well why this value is empty. can I get some advice?

config/settings/test.yml

cloudfront:
 host: 'localhost'

config/initializers/refile.rb

Refile.cdn_host = Settings.cloudfront.host

Incidentally when I change it as follows,

Refile.cdn_host = 'localhost'

it does work without being empty.

user3395249
  • 69
  • 1
  • 7

1 Answers1

0

You need to load the file first, try

Refile.cdn_host = YAML.load_file("#{Rails.root.to_s}/config/settings/test.yml")['cloudfront']['host']
Md. Farhan Memon
  • 6,055
  • 2
  • 11
  • 36