Module: TaxonName::MatrixHooks

Extended by:
ActiveSupport::Concern
Defined in:
app/models/taxon_name/matrix_hooks.rb

Instance Method Summary collapse

Instance Method Details

#coordinate_observation_matrix_row_itemsObject

Returns Scope

Returns:

  • Scope



5
6
7
8
# File 'app/models/taxon_name/matrix_hooks.rb', line 5

def coordinate_observation_matrix_row_items
  ObservationMatrixRowItem::Dynamic::TaxonName.joins(:taxon_name)
    .where( taxon_name: self_and_ancestors )
end

#in_scope_observation_matrix_row_itemsObject



10
11
12
13
# File 'app/models/taxon_name/matrix_hooks.rb', line 10

def in_scope_observation_matrix_row_items
  return [] unless parent_id_changed?
  TaxonName.find(parent_id_change.last).coordinate_observation_matrix_row_items
end

#out_of_scope_observation_matrix_row_itemsObject



15
16
17
18
# File 'app/models/taxon_name/matrix_hooks.rb', line 15

def out_of_scope_observation_matrix_row_items
  return [] unless parent_id_changed? && parent_id_change.first
  TaxonName.find(parent_id_change.first).coordinate_observation_matrix_row_items   
end