Method: Sequel::Plugins::Touch::InstanceMethods#touch

Defined in:
lib/sequel/plugins/touch.rb

#touch(column = nil) ⇒ Object

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.



107
108
109
110
111
112
113
114
115
# File 'lib/sequel/plugins/touch.rb', line 107

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