Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (17 sloc) 1.12 KB


Given a bunch of ruby Hash, an ActiveRecord model class and a unique key, DataPatcher creates a Hash of the differences between the bunch of Hash and the table.

Have a look at the (very simple) spec/data_patcher.rb to get a better understanding of what’s possible.


This is useful if you are aggregating various data sources and what to have a good level of control on what is added or modified. I do that on and for some of my clients data processing.

When doing this, I tend to parse all the sources again, compare the result to already registered data, and see what are the differences and if they should be applied.


Edit spec/database.yml and run rake spec.

Test data is recreated automatically when running rake spec.


  • find another name – I don’t like DataPatcher
  • find a better Hash patch format
    • move the key outside the diff Hash ?
  • support removed records ? (I don’t need that for the moment)
  • add some way to apply the patch directly inside DataPatcher ?


Copyright © 2008 Thibaut Barrère. See LICENSE for details.