Models - StanfordBioinformatics/pulsar_lims GitHub Wiki
Model concerns
Functionality that is common to models has been separated out into model concerns in the directory at /app/models/concerns
.
model_concern.rb contains functionality that is required by every model and is thus included in every model. For example, it defines a display()
instance method that is typically called on the model record in view code in order to get a user-friendly display value for a link to that record. It also defines get_record_id()
, whose purpose is to compose a calculated field consisting of the model class's abbreviation and the record's ID, i.e. B-1 for the Biosample with ID 1, or SREQ-3 for the SequencingRequest with ID 3. A model's abbreviation is defined in it's class definition via the constant ABBR
. get_record_id()
is called in views/application_partials/_record_meta.html.erb
, which in turn is rendered in each model's show view.
Biosample
A biosample that is part of a SingleCellSorting experiment is named automatically according to a predefined format. The biosample is linked to a well of a plate in the experiment, and the naming convention reflects that. The default name for such a biosample includes the name of the sorting experiment, followed by the name of the plate, followed by the name of the well (space delimited).
Document
Documents represent files that can be reused, or linked to from multiple objects. Each document name must be unique. These are typically protocols. For other types of files that are not reused across objects, please see the FileReference model.