An adaptation of seed-fu, to make seeds.rb a bit nicer

Posted by Adrian O'Connor Tue, 12 Jan 2010 17:47:00 GMT

The db:seed rake task in Rails is a nice addition and we use it a lot. The trouble is, you end up writing a lot of redundant code to check if records exist and stuff like that. Not very DRY, not very Rails.

Seed-Fu is a nice plugin that works very well, but it replaces the new db:seed rake task, and this solution is far more light-weight. You add another file to your db folder, seeds-helper.rb, and just require it at the top of seeds.rb.

Categories

Code Spaces is an online development and collaboration service that includes: Subversion Hosting, Project Management, Work Items, Forums, and much more.

Check it out!


Syndicate

Archives



Powered by Olark