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
335 336 337 338 339 340 341 342 343 344 |
# File 'lib/genealogy/query_methods.rb', line 335 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
330 331 332 |
# File 'lib/genealogy/query_methods.rb', line 330 def females where(sex: sex_female_value) end |
#males ⇒ ActiveRecord::Relation
all male individuals
325 326 327 |
# File 'lib/genealogy/query_methods.rb', line 325 def males where(sex: sex_male_value) end |