lib/baby_squeel/join_dependency.rb
# 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.
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.
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 .
def find_alias(associations)
        if BabySqueel::ActiveRecord::VersionHelper.at_least_6_1?
           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
        elsif BabySqueel::ActiveRecord::VersionHelper.at_least_5_2_3?
           If we tell join_dependency to construct its tables, Active Record
           handles building the correct aliases and attaching them to its
           JoinDepenencies.
          join_dependency.send(:construct_tables!, join_dependency.send(:join_root))
        end
        join_association = find_join_association(associations)
        join_association.table
      end
def find_alias ( associations ) if BabySqueel :: ActiveRecord :: VersionHelper . at_least_6_1? join_root = join_dependency . send ( :join_root ) join_root . each_children do | parent , child | join_dependency . construct_tables_for_association! ( parent , child ) end elsif BabySqueel :: ActiveRecord :: VersionHelper . at_least_5_2_3? join_dependency . send ( :construct_tables! , join_dependency . send ( :join_root ) ) end join_association = find_join_association ( associations ) join_association . table end
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.
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 .
# 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 # If we tell join_dependency to construct its tables, Active Record # handles building the correct aliases and attaching them to its # JoinDepenencies.
associations