module Sequel::Plugins::Touch::InstanceMethods

  1. lib/sequel/plugins/touch.rb

Methods

Public Instance

  1. after_create
  2. after_destroy
  3. after_update
  4. touch

Public Instance methods

after_create()

Touch all of the model’s touched_associations when creating the object.

[show source]
   # File lib/sequel/plugins/touch.rb
86 def after_create
87   super
88   touch_associations
89 end
after_destroy()

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

[show source]
   # File lib/sequel/plugins/touch.rb
92 def after_destroy
93   super
94   touch_associations
95 end
after_update()

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

[show source]
    # File lib/sequel/plugins/touch.rb
 98 def after_update
 99   super
100   touch_associations
101 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
107 def touch(column=nil)
108   if column
109     set(column=>touch_instance_value)
110   else
111     column = model.touch_column
112     set(column=>touch_instance_value) if columns.include?(column)
113   end
114   save_changes
115 end