Created
May 27, 2014 16:54
-
-
Save justinweiss/a901a7a8560626e54a6b to your computer and use it in GitHub Desktop.
Simple settings for Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
require 'erb' | |
require 'ostruct' | |
class Settings < OpenStruct | |
# Settings.new(:google_analytics) | |
def initialize(config_file_base_name) | |
super(YAML.load(ERB.new(File.read(Rails.root.join("config", "#{config_file_base_name}.yml"))).result)[Rails.env]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment