Skip to content

Instantly share code, notes, and snippets.

@chsh
Created September 11, 2011 14:22
Show Gist options
  • Save chsh/1209646 to your computer and use it in GitHub Desktop.
Save chsh/1209646 to your computer and use it in GitHub Desktop.
Load Rails related configuration from yaml file with erb evaluation.
require 'erb'
class ConfigLoader
def self.from(yaml)
yaml = File.read(yaml) if File.exist?(yaml)
YAML.load(ERB.new(yaml).result)[Rails.env]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment