Module: Upkeep::Runtime::PersistenceObserver
- Defined in:
- lib/upkeep/runtime.rb
Instance Method Summary collapse
Instance Method Details
#touch(*names, **options) ⇒ Object
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 |
# File 'lib/upkeep/runtime.rb', line 880 def touch(*names, **) changed_attributes = upkeep_touch_column_names(names) super.tap do |result| if result && changed_attributes.any? ChangeLog.record( ChangeEvents.active_record_update_columns( self, changed_attributes: changed_attributes, new_values: upkeep_touch_column_values(changed_attributes) ) ) end end end |
#update_columns(attributes) ⇒ Object
896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
# File 'lib/upkeep/runtime.rb', line 896 def update_columns(attributes) new_values = upkeep_update_column_values(attributes) changed_attributes = new_values.keys super.tap do |result| if result ChangeLog.record( ChangeEvents.active_record_update_columns( self, changed_attributes: changed_attributes, new_values: new_values ) ) end end end |