Class Index [+]

Quicksearch

Sequel::Plugins::Touch::InstanceMethods

Public Instance Methods

after_destroy() click to toggle source

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

    # File lib/sequel/plugins/touch.rb, line 83
83:         def after_destroy
84:           super
85:           touch_associations
86:         end
after_update() click to toggle source

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

    # File lib/sequel/plugins/touch.rb, line 89
89:         def after_update
90:           super
91:           touch_associations
92:         end
touch(column=nil) click to toggle source

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.

     # File lib/sequel/plugins/touch.rb, line 98
 98:         def touch(column=nil)
 99:           if column
100:             set(column=>touch_instance_value)
101:           else
102:             column = model.touch_column
103:             set(column=>touch_instance_value) if columns.include?(column)
104:           end
105:           save_changes
106:         end

Private Instance Methods

touch_association_value() click to toggle source

The value to use when modifying the touch column for the association datasets. Uses the SQL standard CURRENT_TIMESTAMP.

     # File lib/sequel/plugins/touch.rb, line 112
112:         def touch_association_value
113:           Sequel::CURRENT_TIMESTAMP
114:         end
touch_associations() click to toggle source

Directly update the database using the association dataset for each association.

     # File lib/sequel/plugins/touch.rb, line 117
117:         def touch_associations
118:           model.touched_associations.each do |meth, column|
119:             send(meth).update(column=>touch_association_value)
120:           end
121:         end
touch_instance_value() click to toggle source

The value to use when modifying the touch column for the model instance. Uses Time.now to work well with typecasting.

     # File lib/sequel/plugins/touch.rb, line 125
125:         def touch_instance_value
126:           Time.now
127:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.