Class: AssetLink

Inherits:
ApplicationRecord show all
Includes:
Api::AssetLinkIO::Extensions, Uuid::Uuidable
Defined in:
app/models/asset_link.rb

Overview

AssetLink is powered by acts-as-dag Briefly, acts-as-dag attempts to implement a directed-acyclic-graph in a relational database. In order to optimize for retrieval it inserts an AssetLink record for EACH ancestor-descendant link. As a result, it is possible to retrieve ALL ancestors for a given plate in a single query. On the flip side, this makes insert operations more expensive as the graph grows.

As a result, try and avoid adding wells in to asset links, and link between Labware only.

The children,parents,ancestors,descendants methods are all Rails associations, and so can have further scopes applied to them

Examples:

Example methods

plate.children # => [<Plate: child of plate>,<Plate: child of plate>]
plate.parents # => [<Plate: parent of plate>]
plate.descendants # => [<Plate: child of plate>,<Plate: child of plate>,<Plate: grandchild of plate>]
plate.ancestors # => [<Plate: parent of plate>,<Plate: grandparent of plate>]

Retrieve all ancestors of a particular purpose

plate.ancestors.where(purpose_id: 4)

See Also:

Defined Under Namespace

Modules: Associations Classes: Job

Instance Method Summary collapse

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods included from Api::AssetLinkIO::Extensions

included

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#destroy!Object


43
44
# File 'app/models/asset_link.rb', line 43

def destroy!
end