I am looking for the best way to populate the reference tables in my rails application - for dev, test, and production (the most important, of course, being for production). (Ideally, I think using essentially the same procedure for all three would be the best, or at least, easiest solution; but I suspect this may not be practical or wise.)
For example, I am about to create a table for basic stock information that usually doesn't change (fields: symbol, name, sector, industry). I need this table to be loaded (for example, via a text file containing this data for all US stocks) the first time the application is run in production, as well as in testing and development whenever the table has not yet been loaded. (In case it matters re. my question, it's extremely likely this table will be updated as new data [e.g., for a company that just went public] becomes available.)
I was surprised that I didn't find this question already in stackoverflow. It might be in there, but it's not findable with the searches I tried. I found a couple similar questions (e.g., seeding test data), but not close enough to provide what I'm looking for. I couldn't even find much via google searches! I did, however, find this: https://codingitwrong.com/2016/07/29/how-to-seed-and-migrate-rails-data.html In particular, the author says: "The seeds file is commonly used for both of these [reference data vs sample data], but that makes it difficult to set up initial data in production. The Rails guides don’t make it clear which of these the seeds file is for... It can be useful to separate the two out. Thoughtbot recommends using the seeds file for reference data, and setting up a separate Rake task for sample data."
(Note: Based on the above quote I googled for "rails what is the seeds.rb file for?" and found this Q/A: What is the function of the seeds.rb file?, which recommends using seeds.rb for reference data. So perhaps using seeds.rb is the best answer. If so, that appears to imply that seeds.rb should be used for reference data and not test setup.)