Module: Shared::BiologicalAssociations::ClassMethods

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

Overview

end end

Instance Method Summary collapse

Instance Method Details

#with_biological_relationship_ids(biological_relationship_ids) ⇒ Object

Parameters:

  • relationship (Array, String)


69
70
71
72
73
74
# File 'app/models/concerns/shared/biological_associations.rb', line 69

def with_biological_relationship_ids(biological_relationship_ids) 
  a = joins(:biological_associations).where(biological_associations: {biological_relationship_id: biological_relationship_ids})
  b = joins(:related_biological_associations).where(biological_associations: {biological_relationship_id: biological_relationship_ids})
  
  from("((#{a.to_sql}) UNION (#{b.to_sql})) as #{base_class.table_name}")
end