Module: Specify::Model::Updateable

Overview

Updateable is a mixin that provides the standard #before_update hook for Specify::Model classes.

Most tables in the Specify schema have a Version (an Integer) that is incremented for each modification and a modification timestamp. The #before_update hook will set these.

Instance Method Summary collapse

Instance Method Details

#before_updateObject

Sets the Version and modification timestamp of a record.



13
14
15
16
17
# File 'lib/specify/models/updateable.rb', line 13

def before_update
  self[:Version] += 1
  self[:TimestampModified] = Time.now
  super
end