Class: AssetLink

ApplicationRecord show all
Api::AssetLinkIO::Extensions, Uuid::Uuidable
Defined in:


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


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


Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify


Methods included from Warren::BroadcastMessages

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

Instance Method Details


# File 'app/models/asset_link.rb', line 33

def destroy!