batch-loader-active-record 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 677a8d4077a4cb32b88a1622cf0ff134b8ee496f
4
- data.tar.gz: 1379446245d1cfda4b6e24b533ea6cbf10dde8ea
3
+ metadata.gz: d7d1ba39cf3a3de836849d980d1f31815990d6e0
4
+ data.tar.gz: ce551c5339a932ba20dda200364e2789f644bafb
5
5
  SHA512:
6
- metadata.gz: 4d4084ac2f43f85b4a1cb67cd7ed122b23ed79af1f62abb6a61afe9c09ef094f4b5934541799417d0e81f32e2d0b330c0d5b708fc5baed3f4136242efec357b1
7
- data.tar.gz: 5fb6c5f42f3144b2b65af518efb714f372f2b48270dead47fa0892616daceca53e4d5a7c91b23095ea25a57a3b72977659154e02df7448f39a0e08622490131e
6
+ metadata.gz: 386454aeb0a0152f309eb5922a6cb629546d06e3228830257038fc2770d6102eb6a347eda3d19885a34d6c868825e1f83ae2e607d2d16b655301366f73c1d11d
7
+ data.tar.gz: 4a98d66b1cf4c93045856335572cd642daee0493106c02ab169946f1dde2cb016f63a012c5a56e85ddd682e7a2f0bbbe30ed6ef02028b7bd4a5f5ea6813afcd6
@@ -4,6 +4,10 @@ Unreleased
4
4
 
5
5
  * none
6
6
 
7
+ v0.4.1
8
+
9
+ * fix cache issue when calling lazy association accessor with different scopes for `has_and_belongs_to` associations
10
+
7
11
  v0.4.0
8
12
 
9
13
  * support `has_and_belongs_to` associations
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- batch-loader-active-record (0.4.0)
4
+ batch-loader-active-record (0.4.1)
5
5
  activerecord (>= 4.2.0, < 5.2.0)
6
6
  activesupport (>= 4.2.0, < 5.2.0)
7
7
  batch-loader (~> 1.2.0)
@@ -46,7 +46,9 @@ module BatchLoaderActiveRecord
46
46
  end
47
47
 
48
48
  def has_and_belongs_to_many_to_batch_loader(instance, instance_scope)
49
- BatchLoader.for(instance.id).batch(default_value: [], key: batch_key) do |model_ids, loader|
49
+ custom_key = batch_key
50
+ custom_key += [instance_scope.to_sql.hash] unless instance_scope.nil?
51
+ BatchLoader.for(instance.id).batch(default_value: [], key: custom_key) do |model_ids, loader|
50
52
  instance_id_path = "#{reflection.join_table}.#{reflection.foreign_key}"
51
53
  relation_with_scope(instance_scope)
52
54
  .joins(habtm_join(reflection))
@@ -1,3 +1,3 @@
1
1
  module BatchLoaderActiveRecord
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batch-loader-active-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mathieul