module Genealogy::QueryMethods::ClassMethods

Public Instance Methods

all_with(role) click to toggle source

all individuals individuals having relative with specified role @return [ActiveRecord, ActiveRecord::Relation]

# File lib/genealogy/query_methods.rb, line 374
def all_with(role)
  case role
  when :father
    where('father_id is not ?',nil)
  when :mother
    where('mother_id is not ?',nil)
  when :parents
    where('father_id is not ? and mother_id is not ?',nil,nil)
  end
end
females() click to toggle source

all female individuals @return [ActiveRecord::Relation]

# File lib/genealogy/query_methods.rb, line 369
def females
  where(sex: sex_female_value)
end
males() click to toggle source

all male individuals @return [ActiveRecord::Relation]

# File lib/genealogy/query_methods.rb, line 364
def males
  where(sex: sex_male_value)
end