not being able to access the info loaded by config.yml

Hi,

I have the following app_config.yml in rails_root/config/

development: &non_production_settings   :bit_ly:     :login: "xxxxxxxxx"     :api_key: "xxxxxxxxx"     :history: "0"

test:   <<: *non_production_settings

production:   :bit_ly:APP_CONFIG = YAML.load(File.read(RAILS_ROOT + "/config/app_config.yml"))[RAILS_ENV]     :login: "xxxxxxxxx"     :api_key: "xxxxxxxxx"     :history: "1"

i am loading this config file with following

APP_CONFIG = YAML.load(File.read(RAILS_ROOT + "/config/app_config.yml"))[RAILS_ENV]

in my lib/somefolder/comeclass i am calling

APP_CONFIG[:bit_ly][:history] which results in an error 'const-missing'

what can be the reason?

I think yaml keys need to be strings, not symbols, i.e. that would read:

development:   bit_ly:     login: something     api_key: secret     history: 0

Felix

I think yaml keys need to be strings, not symbols, i.e. that would read:

development:   bit_ly:     login: something     api_key: secret     history: 0

Felix

Well I followed the info provided here:

and am able to access the data easily

the error i get for this code here:

URI.parse("http://api.bit.ly/shorten?version=2.0.1&longUrl=&quot; + string +"&login=" + APP_CONFIG[:bit_ly][:login] + "&apiKey=" + APP_CONFIG[:bit_ly][:api_key] + "&history=" + APP_CONFIG[:bit_ly][:history] + "&format=xml")

is

NameError: uninitialized constant CreateUrl::APP_CONFIG from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/ dependencies.rb:105:in `const_missing' from /home/rails/app1/lib/mycode/create_url.rb:6:in `bit_ly_for_vehicle'