bullet 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.textile +2 -2
- data/lib/bullet/active_record31.rb +4 -4
- data/lib/bullet/version.rb +1 -1
- data/spec/spec_helper.rb +5 -5
- metadata +5 -5
data/Gemfile.lock
CHANGED
data/README.textile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
h1. Bullet
|
2
2
|
|
3
|
-
!https://secure.travis-ci.org/flyerhzm/
|
3
|
+
!https://secure.travis-ci.org/flyerhzm/bullet.png!:http://travis-ci.org/flyerhzm/bullet
|
4
4
|
|
5
5
|
The Bullet plugin/gem is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries), when you're using eager loading that isn't necessary and when you should use counter cache.
|
6
6
|
|
7
7
|
Best practice is to use Bullet in development mode or custom mode (staging, profile, etc.). The last thing you want is your clients getting alerts about how lazy you are.
|
8
8
|
|
9
|
-
The Bullet plugin/gem now supports rails 2.1, 2.2, 2.3, 3.0 and 3.
|
9
|
+
The Bullet plugin/gem now supports rails 2.1, 2.2, 2.3, 3.0, 3.1 and 3.2.
|
10
10
|
|
11
11
|
****************************************************************************
|
12
12
|
|
@@ -69,7 +69,7 @@ module Bullet
|
|
69
69
|
origin_load_target
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
::ActiveRecord::Associations::Association.class_eval do
|
74
74
|
# call has_one and belong_to association
|
75
75
|
alias_method :origin_load_target, :load_target
|
@@ -85,9 +85,9 @@ module Bullet
|
|
85
85
|
::ActiveRecord::Associations::HasManyAssociation.class_eval do
|
86
86
|
alias_method :origin_has_cached_counter?, :has_cached_counter?
|
87
87
|
|
88
|
-
def has_cached_counter?
|
89
|
-
result = origin_has_cached_counter?
|
90
|
-
Bullet::Detector::Counter.add_counter_cache(
|
88
|
+
def has_cached_counter?(reflection = reflection)
|
89
|
+
result = origin_has_cached_counter?(reflection)
|
90
|
+
Bullet::Detector::Counter.add_counter_cache(owner, reflection.name) unless result
|
91
91
|
result
|
92
92
|
end
|
93
93
|
end
|
data/lib/bullet/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'pry'
|
1
|
+
#require 'pry'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rspec'
|
4
4
|
require 'rspec/autorun'
|
@@ -21,8 +21,8 @@ ActiveRecord::Migration.verbose = false
|
|
21
21
|
|
22
22
|
module Bullet
|
23
23
|
def self.collected_notifications_of_class( notification_class )
|
24
|
-
Bullet.notification_collector.collection.select do |notification|
|
25
|
-
notification.is_a? notification_class
|
24
|
+
Bullet.notification_collector.collection.select do |notification|
|
25
|
+
notification.is_a? notification_class
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -60,7 +60,7 @@ module Bullet
|
|
60
60
|
# returns true if a given class includes the specific unpreloaded association
|
61
61
|
def detecting_unpreloaded_association_for?(klass, association)
|
62
62
|
for_class_and_assoc = Bullet.collected_n_plus_one_query_notifications.select do |notification|
|
63
|
-
notification.base_class == klass and
|
63
|
+
notification.base_class == klass and
|
64
64
|
notification.associations.include?( association )
|
65
65
|
end
|
66
66
|
for_class_and_assoc.present?
|
@@ -69,7 +69,7 @@ module Bullet
|
|
69
69
|
# returns true if the given class includes the specific unused preloaded association
|
70
70
|
def unused_preload_associations_for?(klass, association)
|
71
71
|
for_class_and_assoc = Bullet.collected_unused_eager_association_notifications.select do |notification|
|
72
|
-
notification.base_class == klass and
|
72
|
+
notification.base_class == klass and
|
73
73
|
notification.associations.include?( association )
|
74
74
|
end
|
75
75
|
for_class_and_assoc.present?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uniform_notifier
|
16
|
-
requirement: &
|
16
|
+
requirement: &70099725738900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70099725738900
|
25
25
|
description: A rails plugin to kill N+1 queries and unused eager loading.
|
26
26
|
email:
|
27
27
|
- flyerhzm@gmail.com
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
segments:
|
91
91
|
- 0
|
92
|
-
hash:
|
92
|
+
hash: 2965247707875627527
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|