Simple database question

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.

On 24 May 2011 20:55, Benjamin M. [email protected]
wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs