Set the touch_column for the subclass to be the same as the current class. Also, create a copy of the touched_associations in the subclass.
# File lib/sequel/plugins/touch.rb, line 61 61: def inherited(subclass) 62: super 63: subclass.touch_column = touch_column 64: subclass.instance_variable_set(:@touched_associations, touched_associations.dup) 65: end
Add additional associations to be touched. See the :association option of the Sequel::Plugin::Touch.configure method for the format of the associations arguments.
# File lib/sequel/plugins/touch.rb, line 70 70: def touch_associations(*associations) 71: associations.flatten.each do |a| 72: a = {a=>touch_column} if a.is_a?(Symbol) 73: a.each do |k,v| 74: raise(Error, "invalid association: #{k}") unless r = association_reflection(k) 75: touched_associations[r.dataset_method] = v 76: end 77: end 78: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.