Module: ActiveRecord::JSONB::Associations::Preloader::Association

Defined in:
lib/activerecord/jsonb/associations/preloader/association.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#records_for(ids) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/activerecord/jsonb/associations/preloader/association.rb', line 6

def records_for(ids)
  return super unless reflection.options.key?(:foreign_store)

  scope.where(
    Arel::Nodes::JSONBHashArrow.new(
      table,
      table[reflection.options[:foreign_store]],
      association_key_name
    ).intersects_with(ids)
  )
end