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.

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

Categories

Tags

About apple Beta Bug Code CodeSpaces comingsoon FREE Hosting HowTo images preview Price rails Signup Spaces Subversion SVN Upgrade v2.0

Archives

Syndicate