module Sequel::Plugins::Touch::InstanceMethods

  1. lib/sequel/plugins/touch.rb
Parent: Touch

Methods

Public Instance

  1. after_destroy
  2. after_update
  3. touch

Public Instance methods

after_destroy ()

Touch all of the model's touched_associations when destroying the object.

[show source]
# File lib/sequel/plugins/touch.rb, line 80
def after_destroy
  super
  touch_associations
end
after_update ()

Touch all of the model's touched_associations when updating the object.

[show source]
# File lib/sequel/plugins/touch.rb, line 86
def after_update
  super
  touch_associations
end
touch (column=nil)

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.

[show source]
# File lib/sequel/plugins/touch.rb, line 95
def touch(column=nil)
  if column
    set(column=>touch_instance_value)
  else
    column = model.touch_column
    set(column=>touch_instance_value) if columns.include?(column)
  end
  save_changes
end