Module: Shared::IsDwcOccurrence::ClassMethods

Defined in:
app/models/concerns/shared/is_dwc_occurrence.rb

Instance Method Summary collapse

Instance Method Details

#dwc_attribute_vector(mode = :all) ⇒ Object

Returns Array of Arel::Attributes::Attribute.

Returns:

  • Array of Arel::Attributes::Attribute



32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/models/concerns/shared/is_dwc_occurrence.rb', line 32

def dwc_attribute_vector(mode = :all)
  t = ::DwcOccurrence.arel_table
  s = self.arel_table

  k = self::DWC_OCCURRENCE_MAP.keys #.sort

  if mode.to_sym == :view
    k = k - self::VIEW_EXCLUSIONS
  end

  [ s[:id], t[:id], t[:dwc_occurrence_object_type], *k.collect{|a| t[a]} ]
end

#dwc_attribute_vector_names(mode = :all) ⇒ Object



45
46
47
# File 'app/models/concerns/shared/is_dwc_occurrence.rb', line 45

def dwc_attribute_vector_names(mode = :all)
  ["#{self.name.tableize}_id", 'dwc_occurrence_id'] + dwc_attribute_vector(mode)[2..-1].collect{|a| a.name}
end