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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 383fdf528838afb5b7b3062473c4cee08afde2a6
4
- data.tar.gz: 876d2f512122a2efc65966ae0ca79552a942e55b
3
+ metadata.gz: e402a50f9b2a4c75edafcf12bc2bdb32e3298860
4
+ data.tar.gz: 73102589e922894098fe54684ac483c8ef6b44b7
5
5
  SHA512:
6
- metadata.gz: be6b084a5b2a8a969b9c4de0f5d4edf6b45519bab43daac4a28e16bf2d91d4adcb709555b2b1b914187e37cdd4344606df26f2324bd3e578c1d553fd2d8ff079
7
- data.tar.gz: cefcd37562b41f889399face565a9335b7ed47a5627c9a837b53c31803dc40c72f5f31adeaf619ad233b4e60927900b4b336877f2966d94ea19e66dffaf88dd5
6
+ metadata.gz: 03191a02a885f763bbe24986fdad49f5f9e6d19f6f9a4501ff0c5915b1bb3eaf4cebde6b611be5c0a99982eef12ea32e1e3c51ad6a7a8d3029a1d38ea285d7c8
7
+ data.tar.gz: dffc316bd5cbacaee45d5ef161bfb63f159a24006d09baf7a5572cfed72a21f970a668c55799fceb2e48705625074fa257bdd0d608a5391c54a5e13e1b354577
@@ -1,5 +1,9 @@
1
1
  # Next Release
2
2
 
3
+ ## 4.14.8
4
+
5
+ * compatible with `composite_primary_keys` gem
6
+
3
7
  ## 4.14.7
4
8
 
5
9
  * Fix AR 4.2 SingularAssociation#reader result can be nil
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:
@@ -4,7 +4,9 @@ class Object
4
4
  end
5
5
 
6
6
  def primary_key_value
7
- if self.class.respond_to?(:primary_key) && self.class.primary_key
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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Bullet
3
- VERSION = "4.14.7"
3
+ VERSION = "4.14.8"
4
4
  end
@@ -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.7
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-05-09 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport