Using Rails 3.1.1. This is my YAML file in config/app_config.yml
development: &non_production_settings
site_url: http://localhost:3000
This is my stripped config/application.rb
require File.expand_path('../boot', __FILE__)
# load app_config.yml
require 'yaml'
APP_CONFIG = YAML.load(File.read(File.expand_path('../app_config.yml', __FILE__)))
require 'rails/all'
I tried to put site_url in my template, even abort it, but it’s still returning nil:
<%= abort(APP_CONFIG[:site_url]) %> #returns: can't convert nil into String
What have I done wrong? Thanks!
I have to move the code a bit and add an environment to it:
Then access the constant globally: