I want to be able to select a yaml file inside a folder called market. This folder will be in config/market. Inside this folder I will have many yaml files, for example:
config/market
usa.yml
cad.yml
eur.yml
Inside each yml file I will have same variables but different default values. for example on usa.yml
---
:usa
country: "United States"
currency: "USD"
For eur.yml,
---
:eur
country: "European Union"
currency: "EUR"
and so on. I want to use country and currency as global variables for example in my rails app. Depending on user location I will select the yaml file.
I want to select only one yaml file from the market folder when the user login in my application. Maybe do a before_action call in the application controller. Something like this
before_action :set_market
private
def set_market
if (statement)
Config[:market] = :usa
end
end
How can I do this? Please any feedback will help.