Module: Otu::MatrixHooks

Extended by:
ActiveSupport::Concern
Included in:
Otu
Defined in:
app/models/otu/matrix_hooks.rb

Instance Method Summary collapse

Instance Method Details

#member_of_current_matrix_row_items ⇒ Object

Dynamic::TaxonName row items that include this item as a member through its taxon_name_id (tag membership is released by Tag's own matrix hooks)



19
20
21
22
23
# File 'app/models/otu/matrix_hooks.rb', line 19

def member_of_current_matrix_row_items
  return [] if taxon_name_id.nil?
  TaxonName.find_by(id: taxon_name_id)
    &.coordinate_observation_matrix_row_items || []
end

#member_of_new_matrix_row_items ⇒ Object

These row items now include this item as a member



12
13
14
15
# File 'app/models/otu/matrix_hooks.rb', line 12

def member_of_new_matrix_row_items
  return [] unless taxon_name_id_change && taxon_name_id_change.last
  TaxonName.find(taxon_name_id_change.last).coordinate_observation_matrix_row_items
end

#member_of_old_matrix_row_items ⇒ Object

These row items used to include this item as a member



6
7
8
9
# File 'app/models/otu/matrix_hooks.rb', line 6

def member_of_old_matrix_row_items
  return [] unless taxon_name_id_changed? && taxon_name_id_change.first
  TaxonName.find(taxon_name_id_change.compact.first).coordinate_observation_matrix_row_items
end