Recalculate the column value hashes after updating.
# File lib/sequel/plugins/modification_detection.rb, line 43 def after_update super recalculate_values_hashes end
Calculate the column hash values if they haven't been already calculated.
# File lib/sequel/plugins/modification_detection.rb, line 49 def calculate_values_hashes @values_hashes || recalculate_values_hashes end
Detect which columns have been modified by comparing the cached hash value to the hash of the current value.
# File lib/sequel/plugins/modification_detection.rb, line 55 def changed_columns cc = super changed = [] v = @values if vh = @values_hashes (vh.keys - cc).each{|c| changed << c unless v.has_key?(c) && vh[c] == v[c].hash} end cc + changed end
Recalculate the column value hashes after manually refreshing.
# File lib/sequel/plugins/modification_detection.rb, line 68 def _refresh(dataset) super recalculate_values_hashes end
Recalculate the column value hashes after refreshing after saving a new object.
# File lib/sequel/plugins/modification_detection.rb, line 74 def _save_refresh super recalculate_values_hashes end
Recalculate the column value hashes, caching them for later use.
# File lib/sequel/plugins/modification_detection.rb, line 80 def recalculate_values_hashes vh = {} @values.each do |k,v| vh[k] = v.hash end @values_hashes = vh.freeze end