I am loading a YAML file in Rails 3.0.9 like this:
APP_CONFIG = YAML.load(File.read(File.expand_path(\'../app.yml\', __FILE__)))
It loads the a
Psych (a.k.a. YAML) provides the keyword argument :symbolize_names to load keys as symbols. See method reference
:symbolize_names
file_path = File.expand_path('../app.yml', __FILE__) yaml_contents = File.read(file_path) APP_CONFIG = YAML.safe_load(yaml_contents, symbolize_names: true)