Module: Genealogy::QueryMethods::ClassMethods
- Defined in:
- lib/genealogy/query_methods.rb
Instance Method Summary collapse
-
#all_with(role) ⇒ ActiveRecord, ActiveRecord::Relation
all individuals individuals having relative with specified role.
-
#females ⇒ ActiveRecord::Relation
all female individuals.
-
#males ⇒ ActiveRecord::Relation
all male individuals.
Instance Method Details
#all_with(role) ⇒ ActiveRecord, ActiveRecord::Relation
all individuals individuals having relative with specified role
374 375 376 377 378 379 380 381 382 383 |
# 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 ⇒ ActiveRecord::Relation
all female individuals
369 370 371 |
# File 'lib/genealogy/query_methods.rb', line 369 def females where(sex: sex_female_value) end |
#males ⇒ ActiveRecord::Relation
all male individuals
364 365 366 |
# File 'lib/genealogy/query_methods.rb', line 364 def males where(sex: sex_male_value) end |