Module: Fakery::Change::Support
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#record_change(name, new_value) ⇒ Object
Record the change to
new_value
for the fieldname
.
Instance Method Details
#record_change(name, new_value) ⇒ Object
Record the change to new_value
for the field name
.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fakery/change.rb', line 41 def record_change(name, new_value) old_value = self[name] if old_value != new_value @changes << Fakery::Change.new( name: name, from: old_value, to: new_value, added: !table.key?(name) ) end self end |