Class: PassiveRecord::Associations::HasManyThroughAssociation
- Inherits:
-
Struct
- Object
- Struct
- PassiveRecord::Associations::HasManyThroughAssociation
- Defined in:
- lib/passive_record/associations/has_many_through.rb
Instance Attribute Summary collapse
-
#base_association ⇒ Object
Returns the value of attribute base_association.
-
#child_class_name ⇒ Object
Returns the value of attribute child_class_name.
-
#parent_class ⇒ Object
Returns the value of attribute parent_class.
-
#target_name_symbol ⇒ Object
Returns the value of attribute target_name_symbol.
-
#through_class ⇒ Object
Returns the value of attribute through_class.
Instance Method Summary collapse
Instance Attribute Details
#base_association ⇒ Object
Returns the value of attribute base_association
3 4 5 |
# File 'lib/passive_record/associations/has_many_through.rb', line 3 def base_association @base_association end |
#child_class_name ⇒ Object
Returns the value of attribute child_class_name
3 4 5 |
# File 'lib/passive_record/associations/has_many_through.rb', line 3 def child_class_name @child_class_name end |
#parent_class ⇒ Object
Returns the value of attribute parent_class
3 4 5 |
# File 'lib/passive_record/associations/has_many_through.rb', line 3 def parent_class @parent_class end |
#target_name_symbol ⇒ Object
Returns the value of attribute target_name_symbol
3 4 5 |
# File 'lib/passive_record/associations/has_many_through.rb', line 3 def target_name_symbol @target_name_symbol end |
#through_class ⇒ Object
Returns the value of attribute through_class
3 4 5 |
# File 'lib/passive_record/associations/has_many_through.rb', line 3 def through_class @through_class end |
Instance Method Details
#nested_association ⇒ Object
8 9 10 11 |
# File 'lib/passive_record/associations/has_many_through.rb', line 8 def nested_association thru_klass = base_association.child_class_name.singularize.constantize thru_klass.associations.detect { |assn| assn.child_class_name == child_class_name } end |
#to_relation(parent_model) ⇒ Object
4 5 6 |
# File 'lib/passive_record/associations/has_many_through.rb', line 4 def to_relation(parent_model) HasManyThroughRelation.new(self, parent_model) end |