module Historiographer::UpdateColumnsWithHistory

The acts_as_paranoid gem, which we tend to use with our History classes, uses update_columns to update deleted_at fields.

In order to make sure these changes are persisted into Histories objects, we also have to record history here.

Public Instance Methods

update_columns(*args) click to toggle source
Calls superclass method
# File lib/historiographer.rb, line 185
def update_columns(*args)
  opts = args.extract_options!
  any_changes = opts.keys.reject { |k| k == "id" }.any?

  transaction do
    persisted = super(opts)

    if any_changes && persisted
      record_history
    end
  end
end