Module: Specify::Model::Createable
- Included in:
- Accession, AppResourceData, AppResourceDir, AutoNumberingScheme, CollectingEvent, CollectionObject, CommonName, Determination, Locality, Preparation, PreparationType, RecordSet, Taxon, ViewSetObject
- Defined in:
- lib/specify/models/createable.rb
Overview
Creatable is a mixin that provides the standard #before_create hook for Specify::Model classes.
Most tables in the Specify schema have a Version (an Integer) that is incremented for each modification and a creation timestamp. The #before_create hook will set these.
Instance Method Summary collapse
-
#before_create ⇒ Object
Initialized the Version to
0
and sets the creation timestamp of a record.
Instance Method Details
#before_create ⇒ Object
Initialized the Version to 0
and sets the creation timestamp of a record.
14 15 16 17 18 |
# File 'lib/specify/models/createable.rb', line 14 def before_create self[:Version] = 0 self[:TimestampCreated] = Time.now super end |