Class: MultiPoolPosition

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

Overview

MultiPoolPosition An instance of a pool in a MultiPool at a specific position.

Instance Method Summary collapse

Instance Method Details

#pipelineObject



34
35
36
37
38
39
40
# File 'app/models/multi_pool_position.rb', line 34

def pipeline
  if pacbio_pool.present?
    :pacbio
  elsif ont_pool.present?
    :ont
  end
end

#pool_presenceObject

Validate that at least one pool is associated We can’t validate pool relationship presence because it’s polymorphic and may be nil during nested creation within multi_pool_positions



23
24
25
26
27
# File 'app/models/multi_pool_position.rb', line 23

def pool_presence
  return unless pacbio_pool.nil? && ont_pool.nil?

  errors.add(:pool, 'must have either a pacbio_pool or ont_pool associated')
end