module Sequel::Plugins::Touch::ClassMethods

  1. lib/sequel/plugins/touch.rb

Attributes

touch_column [RW]

The column to modify when touching a model instance, as a symbol. Also used as the default column when touching associations, if the associations don’t specify a column.

touched_associations [R]

A hash specifying the associations to touch when instances are updated or destroyed. Keys are association name symbols and values are column name symbols.

Public Instance methods

freeze()

Freeze the touched associations when freezing the model class.

[show source]
   # File lib/sequel/plugins/touch.rb
64 def freeze
65   @touched_associations.freeze
66 
67   super
68 end
touch_associations(*associations)

Add additional associations to be touched. See the :association option of the Sequel::Plugin::Touch.configure method for the format of the associations arguments.

[show source]
   # File lib/sequel/plugins/touch.rb
73 def touch_associations(*associations)
74   associations.flatten.each do |a|
75     a = {a=>touch_column} if a.is_a?(Symbol)
76     a.each do |k,v|
77       raise(Error, "invalid association: #{k}") unless association_reflection(k)
78       touched_associations[k] = v
79     end
80   end
81 end