Module: Familyable::Relationships
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/familyable/concerns/relationships.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #descendents(include_self = false) ⇒ Object
- #elders(include_self = false) ⇒ Object
- #family(include_self = false) ⇒ Object
- #master ⇒ Object
- #siblings(include_self = false) ⇒ Object
Instance Method Details
#descendents(include_self = false) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/familyable/concerns/relationships.rb', line 31 def descendents include_self=false query_call( "#{table_name}.id IN (#{descendents_sql_list})", include_self ) end |
#elders(include_self = false) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/familyable/concerns/relationships.rb', line 38 def elders include_self=false query_call( "#{table_name}.id IN (#{elders_sql_list})", include_self ) end |
#family(include_self = false) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/familyable/concerns/relationships.rb', line 52 def family include_self=false query_call( "#{table_name}.id IN (#{family_sql_list})", include_self ) end |
#master ⇒ Object
26 27 28 29 |
# File 'lib/familyable/concerns/relationships.rb', line 26 def master call = elders call.where(klass.without_parents_where_sql).first end |
#siblings(include_self = false) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/familyable/concerns/relationships.rb', line 45 def siblings include_self=false query_call( "#{table_name}.id IN (#{siblings_sql_list})", include_self ) end |