Skip to content

Instantly share code, notes, and snippets.

@a-chernykh
Forked from mislav/application_with_config.rb
Created September 29, 2010 10:22
Show Gist options
  • Save a-chernykh/602527 to your computer and use it in GitHub Desktop.
Save a-chernykh/602527 to your computer and use it in GitHub Desktop.
# needs the "hashie" gem in Gemfile
require 'erb'
module Movies
class Application < Rails::Application
settings = ERB.new(IO.read(File.expand_path('../settings.yml', __FILE__))).result
mash = Hashie::Mash.new(YAML::load(settings)[Rails.env.to_s])
mash.each do |key, value|
config.send("#{key}=", value)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment