简体   繁体   中英

Rails YAML data location

I want to store a list of US States in a YAML file instead of inside a class/module, where would be the best place to put such a file?

I'm guessing somewhere within config. I would like to know the best practice for where such a file would go.

Best practice would probably be the /config directory, as you said.

If you have a lot of configuration files and things need to get more granular, then it might be better to organize these into sub-directories of /config. Other than that, I don't see any reason why /config wouldn't be appropriate.

I maintain an internal gem used extensively within a number of my employer's products, and we put "data" based configuration information of this sort in /config/data, but the choice is really yours.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM