Class: BabySqueel::JoinDependency::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/baby_squeel/join_dependency.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation) ⇒ Builder

Returns a new instance of Builder.



28
29
30
31
32
# File 'lib/baby_squeel/join_dependency.rb', line 28

def initialize(relation)
  @join_dependency = ::JoinDependency.from_relation(relation) do |join|
    :association_join if join.kind_of? BabySqueel::Join
  end
end

Instance Attribute Details

#join_dependencyObject (readonly)

Returns the value of attribute join_dependency.



26
27
28
# File 'lib/baby_squeel/join_dependency.rb', line 26

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.



37
38
39
40
# File 'lib/baby_squeel/join_dependency.rb', line 37

def find_alias(associations)
  table = find_join_association(associations).table
  reconstruct_with_type_caster(table, associations)
end