0.0
No commit activity in last 3 years
No release in over 3 years
YAML seed file loading for Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0

Runtime

>= 3.0.3
 Project Readme

Seed Loader – YAML seed file loading for Rails.¶ ↑

Seed Loader enables you to write seed files in YAML and load them into the database.

Download and installation¶ ↑

The latest version of Seed Loader can be installed with Rubygems:

% [sudo] gem install seed_loader

Include the gem in your Gemfile:

gem 'seed_loader'

Source code can be downloaded from Github:

* http://github.com/dunkelbraun/seed_loader

Usage¶ ↑

Put your YAML based seeds into db/seeds/model_table_name.yml

For a Country model with attributes name and population, 
the seed file (db/seeds/countries.yml) content would be:

country_1:
  name: Australia
  population: 1233344

For belongs_to relationships, you can reference the relationship with the seed name.
If a City belongs to a country then:
  city_1:
    name: Melbourne
    country: country_1

You can also write ruby code inside the YAML seed files:
  city_1:
    name: Melbourne
    country: country_1
    founded_in: <%= 30.years.ago.to_s(:db) %>

In the db/seeds.rb file

SeedLoader::Loader.seed_files_to_db

Run the seeds rake task

rake db:seed

License¶ ↑

Seed Loader is released under the MIT license.