Skip to content

Instantly share code, notes, and snippets.

@AlexandrBasan
Created April 5, 2017 21:25
Show Gist options
  • Save AlexandrBasan/a140a5118f8ca08bbbdec5b3926cf0a3 to your computer and use it in GitHub Desktop.
Save AlexandrBasan/a140a5118f8ca08bbbdec5b3926cf0a3 to your computer and use it in GitHub Desktop.
Read config/settings.yml as a file and convert hash['key'] to hash.key in Ruby
def config_data
settings = ActiveSupport::OrderedOptions.new
data = settings.merge!(Rails.application.config_for(:settings).deep_symbolize_keys!)
data_private = data["data_#{self.id}"]
require 'ostruct'
correct = OpenStruct.new data_private
end
development:
data_1: # data_id
api_uri: "https://test.com"
data_2: # data_id
api_uri: "https://test2.com"
api_token: "3102g1a46f94"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment