Touch all of the model’s touched_associations when destroying the object.
# File lib/sequel/plugins/touch.rb, line 83 83: def after_destroy 84: super 85: touch_associations 86: end
Touch all of the model’s touched_associations when updating the object.
# File lib/sequel/plugins/touch.rb, line 89 89: def after_update 90: super 91: touch_associations 92: end
Touch the model object. If a column is not given, use the model’s touch_column as the column. If the column to use is not one of the model’s columns, just save the changes to the object instead of attempting to a value that doesn’t exist.
# File lib/sequel/plugins/touch.rb, line 98 98: def touch(column=nil) 99: if column 100: set(column=>touch_instance_value) 101: else 102: column = model.touch_column 103: set(column=>touch_instance_value) if columns.include?(column) 104: end 105: save_changes 106: end
The value to use when modifying the touch column for the association datasets. Uses the SQL standard CURRENT_TIMESTAMP.
# File lib/sequel/plugins/touch.rb, line 112 112: def touch_association_value 113: Sequel::CURRENT_TIMESTAMP 114: end
Directly update the database using the association dataset for each association.
# File lib/sequel/plugins/touch.rb, line 117 117: def touch_associations 118: model.touched_associations.each do |meth, column| 119: send(meth).update(column=>touch_association_value) 120: end 121: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.