Module: Specify::Model::Updateable
- Included in:
- Accession, AdministrativeDivision, Agent, AppResourceData, AppResourceDir, AutoNumberingScheme, CollectingEvent, Collection, CollectionObject, CommonName, Determination, Discipline, Division, GeographicName, Geography, Institution, Locality, Preparation, PreparationType, Rank, RecordSet, Taxon, Taxonomy, User, ViewSetObject
- Defined in:
- lib/specify/models/updateable.rb
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
-
#before_update ⇒ Object
Sets the Version and modification timestamp of a record.
Instance Method Details
#before_update ⇒ Object
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 |