Just starting up with rails. I have a textfile with a lot of records in the form Name Description.
I would like to put these into my database. What is the quickest and best way to do this assuming the database is already set up.
Just starting up with rails. I have a textfile with a lot of records in the form Name Description.
I would like to put these into my database. What is the quickest and best way to do this assuming the database is already set up.
You can write code in db/seeds.rb to read the data and write to the database (using your ActiveRecord models). Then run rake db:seed to run seeds.rb and seed the database from your text file. This will default to the development db. To seed the production db do rake RAILS_ENV=production db:seed
Colin