Additional real/virtual attribute change tracking independent of ActiveRecords
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
gemfiles
lib
spec
.travis.yml
Gemfile
Gemfile.lock
Rakefile
Readme.md
delta_changes.gemspec

Readme.md

Additional real/virtual attribute change tracking independent of ActiveRecords

Install

gem install delta_changes

Usage

class User < ActiveRecord::Base
  include DeltaChanges::Extension
  delta_changes :columns => [:name], :attributes => [:full_name]
end

user.name = "bar"
user.delta_changes # => {"name" => [nil, "bar"]}

user.full_name_will_change!
user.delta_changes # => {"name" => [nil, "bar"], "full_name" => [nil, "Mr. Bar"]}

user.save!
user.delta_changes # => {"name" => [nil, "bar"], "full_name" => [nil, "Mr. Bar"]}

user.reset_delta_changes!
user.delta_changes # => {}

Author

Michael Grosser
michael@grosser.it
License: MIT
Build Status