bullet 6.0.1 → 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f255102db3ae1250632db2b30a9e6f1bce87dab49b4dabee73709ffde82a4e0
4
- data.tar.gz: 025ab0e3513546a56e984aa83a0b925d27e631bdfe61feb694b3e21ecfb6ffda
3
+ metadata.gz: 152296ae0c6092687f600a52f129bfa88688b6d5a96db52dd554dbe5db848b11
4
+ data.tar.gz: 65967b8561c27febdab5112572bd5bec8ea7e4d948028eefed843988cedcef99
5
5
  SHA512:
6
- metadata.gz: 23d701691dc1f2286ec11ffb26f548878bfa7ddd2ea8f20d97bb4c64df4e3a7a10f54adb16fa7cacd8bb8807dd1804e349c1b889e32530cbb7c57432ceec17da
7
- data.tar.gz: 281a4a6619695a7db4098f1ed62066cd4e81cf9c2c3bf33fa83f87a205a5c4779e9c8125143a78ca482247ed2a271465b3011af84a5dfc67753cbad2357ee2ae
6
+ metadata.gz: 011db6a9187cbb7d1ce77f249e041b8dda64e8c5cae0ff528081878a3b117cd2180b28c394333504479572eed14701feeba0d4ffa565c235f2fda401b85bd1a0
7
+ data.tar.gz: 332e755d1304b832ccbb4da6c7d05109a11cd62056c0ec911d1346b04e49475cce35c93e8174ca80d5850fbfa8cecc2d6dc630f713d7e681c16d24fb9fac51bc
@@ -1,5 +1,9 @@
1
1
  ## Next Release
2
2
 
3
+ ## 6.0.2 (08/20/2019)
4
+
5
+ * Fully support Rails 6.0
6
+
3
7
  ## 6.0.1 (06/26/2019)
4
8
 
5
9
  * Add Bullet::ActiveJob
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rails', '6.0.0.rc1'
5
+ gem 'rails', '6.0.0'
6
6
  gem 'sqlite3'
7
7
  gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
8
8
  gem 'activerecord-import'
data/README.md CHANGED
@@ -125,7 +125,7 @@ do like
125
125
 
126
126
  ```ruby
127
127
  class ApplicationController < ActionController::Base
128
- around_action :skip_bullet
128
+ around_action :skip_bullet, if: -> { defined?(Bullet) }
129
129
 
130
130
  def skip_bullet
131
131
  previous_value = Bullet.enable?
@@ -84,6 +84,20 @@ module Bullet
84
84
  end
85
85
  end)
86
86
 
87
+ ::ActiveRecord::Associations::Preloader::ThroughAssociation.prepend(Module.new do
88
+ def preloaded_records
89
+ if Bullet.start? && !defined?(@preloaded_records)
90
+ source_preloaders.each do |source_preloader|
91
+ reflection_name = source_preloader.send(:reflection).name
92
+ source_preloader.send(:owners).each do |owner|
93
+ Bullet::Detector::NPlusOneQuery.call_association(owner, reflection_name)
94
+ end
95
+ end
96
+ end
97
+ super
98
+ end
99
+ end)
100
+
87
101
  ::ActiveRecord::FinderMethods.prepend(Module.new do
88
102
  # add includes in scope
89
103
  def find_with_associations
@@ -160,7 +174,7 @@ module Bullet
160
174
  if Bullet.start?
161
175
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
162
176
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
163
- association = owner.association reflection.through_reflection.name
177
+ association = owner.association(reflection.through_reflection.name)
164
178
  Array(association.target).each do |through_record|
165
179
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
166
180
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bullet
4
- VERSION = '6.0.1'
4
+ VERSION = '6.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport