Class: SampleCompoundComponent

Inherits:
ApplicationRecord show all
Defined in:
app/models/sample_compound_component.rb

Overview

A SampleCompoundComponent is a join object for samples, creating a relationship useful for pooling samples in such a way that the compound sample represents a larger number of component samples in receptacles.

Instance Method Summary collapse

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#nested_component_samples_validationObject



21
22
23
24
# File 'app/models/sample_compound_component.rb', line 21

def nested_component_samples_validation
  return if component_sample.component_samples.empty?
  errors.add(:component_sample, 'cannot have further component samples.')
end

#nested_compound_samples_validationObject



16
17
18
19
# File 'app/models/sample_compound_component.rb', line 16

def nested_compound_samples_validation
  return if compound_sample.compound_samples.empty?
  errors.add(:compound_sample, 'cannot have further compound samples.')
end