Sha256: ef6128892ff210bc4db52670b34ea61cad11c732bebc6a3efdddb10640ae9e76

Contents?: true

Size: 761 Bytes

Versions: 6

Compression:

Stored size: 761 Bytes

Contents

# active_record_4.2_ruby_2/join_dependency.rb
require 'polyamorous/activerecord_5.0_ruby_2/join_dependency'

module Polyamorous
  module JoinDependencyExtensions
    # Replaces ActiveRecord::Associations::JoinDependency#join_constraints
    # to call #make_polyamorous_inner_joins instead of #make_inner_joins.
    #
    def join_constraints(outer_joins)
      joins = join_root.children.flat_map { |child|
        make_polyamorous_inner_joins join_root, child
      }
      joins.concat outer_joins.flat_map { |oj|
        if join_root.match? oj.join_root
          walk(join_root, oj.join_root)
        else
          oj.join_root.children.flat_map { |child|
            make_outer_joins(oj.join_root, child)
          }
        end
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ransack-1.8.10 lib/polyamorous/activerecord_4.2_ruby_2/join_dependency.rb
ransack-1.8.9 lib/polyamorous/activerecord_4.2_ruby_2/join_dependency.rb
polyamorous-1.3.3 lib/polyamorous/activerecord_4.2_ruby_2/join_dependency.rb
polyamorous-1.3.2 lib/polyamorous/activerecord_4.2_ruby_2/join_dependency.rb
polyamorous-1.3.1 lib/polyamorous/activerecord_4.2_ruby_2/join_dependency.rb
polyamorous-1.3.0 lib/polyamorous/activerecord_4.2_ruby_2/join_dependency.rb