Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created October 12, 2009 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lytol/208803 to your computer and use it in GitHub Desktop.
Save Lytol/208803 to your computer and use it in GitHub Desktop.
require 'yaml'
module Rails
module App
extend self
def [](key)
config[key]
end
def reload!
@config = nil
end
private
def config
@config ||= YAML::load(IO.read(File.join(Rails.root, "config/application.yml")))[Rails.env].symbolize_keys
end
def method_missing(sym, *args)
if config.has_key?(sym) && args.empty?
return config[sym]
else
super
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment