Download the gem here (gemcutter.org)
Visit the GitHub source here (github.com)
—
I’ve finally created a gem for Ruby on Rails apps. It’s called YamlSeeder, and its at version 0.0.1, naturally.
YamlSeeder takes foxy-fixture-like YAML files and seeds them into your Rails app, using ActiveRecord.
Why I Made It
Originally, I stored all my seed data in YAML fixture files, and loaded them using Fixtures.create_fixtures. This had the benefit of being easy to work with, and easy to maintain. The downside was that it directly inserted the fixtures by SQL into the database’s tables. But I wanted to use the callbacks and validation methods provided by ActiveRecord when seeding. (For example, I wanted to generate a permalink field when saving using “before_save”.)
I modeled YamlSeeder after Fixtures.create_fixtures in ActiveRecord. It supports the belongs_to association, but no other – this will come in a future release.
How Do I Get It?
the easiest way is to type:
gem install yaml_seeder
But for more information, download the gem here. For the current source code, visit my GitHub here.
1 response so far ↓
1 Tweets that mention Introducing YamlSeeder 0.0.1 -- Topsy.com // Jan 21, 2010 at 9:09 pm
[...] This post was mentioned on Twitter by Paul Fedory, Paul Fedory. Paul Fedory said: I've created a new #gem that seeds your databases from #YAML files using #ActiveRecord: http://bit.ly/50R2oQ [...]