Class: BabySqueel::JoinDependency::Builder
- Inherits:
-
Object
- Object
- BabySqueel::JoinDependency::Builder
- Defined in:
- lib/baby_squeel/join_dependency.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#join_dependency ⇒ Object
readonly
Returns the value of attribute join_dependency.
Instance Method Summary collapse
-
#find_alias(associations) ⇒ Object
Find the alias of a BabySqueel::Association, by passing a list (in order of chaining) of associations and finding the respective JoinAssociation at each level.
-
#initialize(relation) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(relation) ⇒ Builder
Returns a new instance of Builder.
41 42 43 |
# File 'lib/baby_squeel/join_dependency.rb', line 41 def initialize(relation) @join_dependency = build(relation, collect_joins(relation)) end |
Instance Attribute Details
#join_dependency ⇒ Object (readonly)
Returns the value of attribute join_dependency.
39 40 41 |
# File 'lib/baby_squeel/join_dependency.rb', line 39 def join_dependency @join_dependency end |
Instance Method Details
#find_alias(associations) ⇒ Object
Find the alias of a BabySqueel::Association, by passing a list (in order of chaining) of associations and finding the respective JoinAssociation at each level.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/baby_squeel/join_dependency.rb', line 48 def find_alias(associations) # construct_tables! got removed by rails # https://github.com/rails/rails/commit/590b045ee2c0906ff162e6658a184afb201865d7 # # construct_tables_for_association! is a method from the polyamorous (ransack) gem join_root = join_dependency.send(:join_root) join_root.each_children do |parent, child| join_dependency.construct_tables_for_association!(parent, child) end join_association = find_join_association(associations) join_association.table end |