bullet 4.14.7 → 4.14.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +16 -0
- data/lib/bullet/ext/object.rb +3 -1
- data/lib/bullet/version.rb +1 -1
- data/spec/bullet/ext/object_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e402a50f9b2a4c75edafcf12bc2bdb32e3298860
|
4
|
+
data.tar.gz: 73102589e922894098fe54684ac483c8ef6b44b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03191a02a885f763bbe24986fdad49f5f9e6d19f6f9a4501ff0c5915b1bb3eaf4cebde6b611be5c0a99982eef12ea32e1e3c51ad6a7a8d3029a1d38ea285d7c8
|
7
|
+
data.tar.gz: dffc316bd5cbacaee45d5ef161bfb63f159a24006d09baf7a5572cfed72a21f970a668c55799fceb2e48705625074fa257bdd0d608a5391c54a5e13e1b354577
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -109,6 +109,22 @@ Bullet.add_whitelist :type => :unused_eager_loading, :class_name => "Post", :ass
|
|
109
109
|
Bullet.add_whitelist :type => :counter_cache, :class_name => "Country", :association => :cities
|
110
110
|
```
|
111
111
|
|
112
|
+
If you want to skip bullet in some specific controller actions, you can
|
113
|
+
do like
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
class ApplicationController < ActionController::Base
|
117
|
+
around_action :skip_bullet
|
118
|
+
|
119
|
+
def skip_bullet
|
120
|
+
Bullet.enable = false
|
121
|
+
yield
|
122
|
+
ensure
|
123
|
+
Bullet.enable = true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
112
128
|
## Log
|
113
129
|
|
114
130
|
The Bullet log `log/bullet.log` will look something like this:
|
data/lib/bullet/ext/object.rb
CHANGED
@@ -4,7 +4,9 @@ class Object
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def primary_key_value
|
7
|
-
if self.class.respond_to?(:
|
7
|
+
if self.class.respond_to?(:primary_keys) && self.class.primary_keys
|
8
|
+
self.class.primary_keys.map { |primary_key| self.send primary_key }.join(',')
|
9
|
+
elsif self.class.respond_to?(:primary_key) && self.class.primary_key
|
8
10
|
self.send self.class.primary_key
|
9
11
|
else
|
10
12
|
self.id
|
data/lib/bullet/version.rb
CHANGED
@@ -27,5 +27,11 @@ describe Object do
|
|
27
27
|
expect(post.primary_key_value).to eq(post.name)
|
28
28
|
Post.primary_key = 'id'
|
29
29
|
end
|
30
|
+
|
31
|
+
it "should return value for multiple primary keys" do
|
32
|
+
post = Post.first
|
33
|
+
allow(Post).to receive(:primary_keys).and_return([:category_id, :writer_id])
|
34
|
+
expect(post.primary_key_value).to eq("#{post.category_id},#{post.writer_id}")
|
35
|
+
end
|
30
36
|
end
|
31
37
|
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: 4.14.
|
4
|
+
version: 4.14.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|