lib/sequel/plugins/touch.rb in sequel-3.48.0 vs lib/sequel/plugins/touch.rb in sequel-4.0.0
- old
+ new
@@ -28,11 +28,11 @@
# Artist.plugin :touch, :associations=>[{:albums=>:updated_on}, :tags]
module Touch
# The default column to update when touching
TOUCH_COLUMN_DEFAULT = :updated_at
- def self.apply(model, opts={})
+ def self.apply(model, opts=OPTS)
model.instance_variable_set(:@touched_associations, {})
end
# Set the touch_column and touched_associations variables for the model.
# Options:
@@ -41,10 +41,10 @@
# a hash with association keys and column values, or an array of
# symbols and/or hashes. If a symbol is used, the column used
# when updating the associated objects is the model's touch_column.
# If a hash is used, the value is used as the column to update.
# * :column - The column to modify when touching a model instance.
- def self.configure(model, opts={})
+ def self.configure(model, opts=OPTS)
model.touch_column = opts[:column] || TOUCH_COLUMN_DEFAULT if opts[:column] || !model.touch_column
model.touch_associations(opts[:associations]) if opts[:associations]
end
module ClassMethods