On 24 May 2011 20:55, Benjamin Mulaosmanovic <[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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to