New to Ruby on Rails? Spread the Word!: DIGG This | Add to del.icio.us
Rails411 is your one stop Ruby on Rails resource directory. Here you will find Ruby on Rails tutorials, Conference & Workshop Listings, Forums, and Hosting. We are the definitive guide for Ruby on Rails web applications, components, gems, scripts, and other related resources for Ruby on Rails. Accomplishing more with your Ruby on Rails website is easy with the help of these tested, pre-packaged, and ready-to-run resources.

Click any category to add your site for free.

Saturday, July 19 2008

Rails411
Dump or Slurp YAML Reference Data (and Fixtures)

Sometimes you need to save data and use it again when you deploy a server or continue a project on a different machine.

I wrote a plugin for ActiveRecord that lets you do this easily.

It adds two class methods that let you dump_to_file and load_from_file. The contents are written to the ‘db’ directory with the table name as the filename. When you call Model.load_from_file, existing data in that table is deleted and reloaded, but primary key id’s are kept intact....


Write Review
Your Name:
Review Title:
Review: