Class: BabySqueel::JoinDependency::Injector6_0

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

Overview

This class allows BabySqueel to slip custom joins_values into Active Record’s JoinDependency

Instance Method Summary collapse

Instance Method Details

#each(&block) ⇒ Object

github.com/rails/rails/pull/36805/files This commit changed group_by to each



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/baby_squeel/join_dependency.rb', line 10

def each(&block)
  super do |join|
    if block.binding.local_variables.include?(:buckets)
      buckets = block.binding.local_variable_get(:buckets)

      case join
      when BabySqueel::Join
        buckets[:association_join] << join
      else
        block.call(join)
      end
    else
      block.call(join)
    end
  end
end