I'm using rails to build a website.
I have a yaml file contails some colors, which is config/colors.yml
---
- white
- red
- blue
- yellow
- ...
And, there is an erb file app/views/users/setting.html.erb
, which will need the data in config/colors.yml
, and put them in a tag.
I don't know what's the correct way to read the yaml file. Can I read once and store them in memory, or I should read it each time the page is requested?