0.01
Low commit activity in last 3 years
A long-lived project that still receives updates
Additional real/virtual attribute change tracking independent of ActiveRecords
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0
>= 0
~> 1.3.6

Runtime

>= 6.0, < 7.2
 Project Readme

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 # => {}

Testing

To run tests: $ rake spec

To run tests with a specific Rails version listed in ./gemfiles, e.g. Rails 5.0:

$ BUNDLE_GEMFILE=gemfiles/rails5.0.gemfile rake spec`

Author

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