Module: Upkeep::Runtime::PersistenceObserver
- Defined in:
- lib/upkeep/runtime.rb
Instance Method Summary collapse
Instance Method Details
#touch(*names, **options) ⇒ Object
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 |
# File 'lib/upkeep/runtime.rb', line 843 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
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 |
# File 'lib/upkeep/runtime.rb', line 859 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 |