lib/sequel/plugins/pg_array_associations.rb in sequel-5.18.0 vs lib/sequel/plugins/pg_array_associations.rb in sequel-5.19.0
- old
+ new
@@ -335,12 +335,14 @@
opts[:dataset] ||= lambda do
opts.associated_dataset.where(Sequel.pg_array_op(opts.predicate_key).contains(Sequel.pg_array([get_column_value(pk)], opts.array_type)))
end
opts[:eager_loader] ||= proc do |eo|
id_map = eo[:id_map]
+ eo = Hash[eo]
+ eo[:loader] = false
- eager_load_results(opts, Hash[eo].merge!(:loader=>false)) do |assoc_record|
+ eager_load_results(opts, eo) do |assoc_record|
if pks ||= assoc_record.get_column_value(key)
pks.each do |pkv|
next unless objects = id_map[pkv]
objects.each do |object|
object.associations[name].push(assoc_record)
@@ -372,11 +374,11 @@
end
end
opts[:eager_grapher] ||= proc do |eo|
ds = eo[:self]
- ds = ds.graph(eager_graph_dataset(opts, eo), conditions, Hash[eo].merge!(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)
+ ds = ds.graph(eager_graph_dataset(opts, eo), conditions, eo.merge(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep), &graph_block)
ds
end
return if opts[:read_only]
@@ -431,11 +433,13 @@
(id_map[apk] ||= []) << object
end
end
end
- eager_load_results(opts, Hash[eo].merge!(:id_map=>id_map)) do |assoc_record|
+ eo = Hash[eo]
+ eo[:id_map] = id_map
+ eager_load_results(opts, eo) do |assoc_record|
if objects = id_map[assoc_record.get_column_value(pkm)]
objects.each do |object|
object.associations[name].push(assoc_record)
end
end
@@ -464,10 +468,10 @@
end
end
opts[:eager_grapher] ||= proc do |eo|
ds = eo[:self]
- ds = ds.graph(eager_graph_dataset(opts, eo), conditions, Hash[eo].merge!(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)
+ ds = ds.graph(eager_graph_dataset(opts, eo), conditions, eo.merge(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep), &graph_block)
ds
end
return if opts[:read_only]