/seedsv

If you want to seed sample data to your app. It's probably better you use csv files. This gem allows it.

Primary LanguageRubyMIT LicenseMIT

Seedsv

Seed your Rails 3 models using CSV files.

Install it

In your gem file:

gem 'seedsv'

Using it

Seedsv requires the developer to create the folder:

Rails.root/db/csv

In this folder you will place all your CSV files with the same name as your database tables. The format of the first line of each file is the following:

column_name_1, column_name_2, column_name_3...

So for example, to seed the model City, you would normally have the file: /db/csv/cities.csv

This is the example content of the file

name, state_id
Monterrey, 1
Guadalajara, 2

To seed the database with this file

rake db:seed:csv

If something goes wrong and you want to delete everything seeded from CSV files:

rake db:seed:cleanup

RDoc

rdoc.info/github/adriancuadros/seedsv/master/frames

Copyright © 2010 Innku. See LICENSE for details.