Skip to content

Instantly share code, notes, and snippets.

@mouse-lin
Created March 5, 2013 12:01
Show Gist options
  • Save mouse-lin/5089859 to your computer and use it in GitHub Desktop.
Save mouse-lin/5089859 to your computer and use it in GitHub Desktop.
load yml
module Settings
def self.get key
val = data.fetch(Rails.env, nil).try(:[], ENV["PLATFORM"]).try(:[], key)
raise "value nil in #{ Rails.en }" if val.nil? && Rails.env != "test"
val
end
def self.data
@data ||= YAML.load_file File.join(Rails.root, "config/settings.yml")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment