Class: Specify::Model::Preparation

Inherits:
Object
  • Object
show all
Includes:
Createable, Updateable
Defined in:
lib/specify/models/preparation.rb

Overview

Preparations are the physical (or virtual) represenatations of a Specify::Model::CollectionObject in a Speciy::Model::Collection.

Collection objects represent the organisms or artifacts collected, the preparations are items derived from that organism or artifacts which are the actual units in a collections physical storage. In an ornithological collection, for example, the collection object will be the bird collected, preparations will be the skin, the skeleton, or any other physcial (or virtual derivatives).

A preparation belongs to a Specify::Model::PreparationType, that provides a controlled vocabulary for available types of preparations (e.g. skin, skeletons, EtOH).

A preparation has a #count, that is the number of items in a preparation. If, for example, the preparation is a jar of shrimps in ethanol, the preparation_type could be EtOH, and if there are 10 shrimps in the jar, the #count would be 10.

Instance Method Summary collapse

Methods included from Updateable

#before_update

Instance Method Details

#before_createObject

Sequel hook that assigns a GUID.



42
43
44
45
# File 'lib/specify/models/preparation.rb', line 42

def before_create
  self[:GUID] = SecureRandom.uuid
  super
end

#countObject

Returns the number of items in a preparation.



48
49
50
# File 'lib/specify/models/preparation.rb', line 48

def count
  self.CountAmt
end