activerecord-precounter 0.3.0 → 0.3.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
  SHA256:
3
- metadata.gz: 5a98de667f01aff0aba4a22a8c277d590e830bcd4f065e2f1c97b7be947fa536
4
- data.tar.gz: 53802ab51ac776f37f9b580dc1601091c06db4be24673bc6265452bd31ea8772
3
+ metadata.gz: fa7ed8a641545585e1fcf838262efb66633387a173d65614d9ed7fe4100f2018
4
+ data.tar.gz: 2362e9a30228774378634e21f89c26f3cd21dd3051c9e56ba1bc2412e51e06fd
5
5
  SHA512:
6
- metadata.gz: 3ed26cb10c38c529ea1fa6d0eb07c454eb1e81e932d07ff6f2e7794f20d1c2696c78159b6130df5bcff68a7201d0c03705a16ce3c7f135ff6c1111cdf52dcd30
7
- data.tar.gz: 7da3ca43d5bbb85820c2ee586d5e8244504c823074cf8af92f38a2651c850ad8be4cb80ccbd19302d546319b511773c5abb6fca369acf590b176ec773429220c
6
+ metadata.gz: 3f7709814cfba9081356cb625c2350ad175384a7d688b439442c565193d315849480ad33b90e04672fa3fa9ebe0ff1a2af194b2c3d5d8853b050096a282cc0d4
7
+ data.tar.gz: 21366e80cab47df357670be5febdbbb1bb62bcea232bce497c5295c7adeed52929a59d41ede31d8919b477e2849b073f1a6168a118d18439f3af6d75141bc090
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ *.sqlite3
@@ -27,7 +27,9 @@ module ActiveRecord
27
27
  end
28
28
 
29
29
  count_by_id = if reflection.has_scope?
30
- reflection.scope_for(reflection.klass.unscoped.where(reflection.inverse_of.name => records.map(&:id))).group(
30
+ # ActiveRecord 5.0 unscopes #scope_for argument, so adding #where outside that:
31
+ # https://github.com/rails/rails/blob/v5.0.7/activerecord/lib/active_record/reflection.rb#L314-L316
32
+ reflection.scope_for(reflection.klass.unscoped).where(reflection.inverse_of.name => records.map(&:id)).group(
31
33
  reflection.inverse_of.foreign_key
32
34
  ).count
33
35
  else
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  class Precounter
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-precounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun