Skip to content

Instantly share code, notes, and snippets.

@meskallito
Created June 9, 2014 21:37
Show Gist options
  • Select an option

  • Save meskallito/5288591020f64259a4e3 to your computer and use it in GitHub Desktop.

Select an option

Save meskallito/5288591020f64259a4e3 to your computer and use it in GitHub Desktop.
Inserting of custom diff logic
class AlterDiffLogicForInvoiceCharges < ActiveRecord::Migration
def change
alter_diff_calculations :invoice_charges, %{
excluded_cols := array_cat(excluded_cols,'{user_id, properties}'::text[]);
changes = ((hstore(NEW.*) - hstore(OLD.*)) - excluded_cols) || (hstore(NEW.properties) - hstore(OLD.properties));
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment