Answer the question
In order to leave comments, you need to log in
Should you use global variables in Rails?
Hey! I have a Rails application. I also have a list of countries that are taken using the VK API. Storing them in a database is kind of silly. Asking every time is also not cool. So the idea came up to store the list in global variables, executing the request only at the time the server starts.
Can you please tell me the best way to organize such an action?
Answer the question
In order to leave comments, you need to log in
https://github.com/huacnlee/rails-settings-cached
Actually, not much different from global variables, but more flexible and looks more logical. Plus, most likely something like this will come in handy anyway.
It must be stored in the database. Stupid to store in global variables and load at server start
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question