I have a yml file and i need the keys to be used in the application.js file in the scripts. I cannot able to access it from the script. Please help me. I have the following lines in the initializer
APP_CONFIG = YAML.load_file("#{Rails.root}/config/filename.yml")[Rails.env]
and i have the following keys in my yml file
development:
key1: 782364764527225794828437
key2: sdjfbjs7e834284383984729
key3: 73465365egfrf36462874727
and i access the keys in application.js file as
APP_CONFIG['key1']
but it seems to take nothing. But when i print the same thing in the view body as
<%= APP_CONFIG['key1'] %>
then it returns the value of the key1.
What should i do to access the value in application.js file. It also not works in the script body in the view itself.