kaminari 0.16.2 → 0.16.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kaminari might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2627d8c87c7ace1ca82760c49c31f7cd7cc0dc3b
4
- data.tar.gz: e8f5c196e7e5a01ad32579f7b3157912b6f2fe9c
3
+ metadata.gz: 1b60c50194b2623ea0fdfedba7baea9a4d675557
4
+ data.tar.gz: 9f98c924aea42ab769c9800e39d739e0ae1ea477
5
5
  SHA512:
6
- metadata.gz: 0cc0e4d37b650625b17c42545cfe6ffb71a7e716a0a7b28bb29330ee506d99a5b4bb820c8cc9ea1ea4379ce45cc00c93772e3d3e966b2808d827e5c5582b006a
7
- data.tar.gz: 26bcfb07c7a0ea59728afd2e140683a66c350687fd96ac40f015530008b1700c1410d481bb25aa935cd6c60c37629105ddb201841432de43cad436f913c006b3
6
+ metadata.gz: 160ad63b6c8b586d82c37bf2c29230b1cb41375679073d628112b6d0023c3eee7e91de6ced19f31f6af02dd0fd5371fd1ab122120645a0f82cda005ff7e26a21
7
+ data.tar.gz: a0bca0e742f945a4ad67dd02406f74df8ae51f4a94bfcb5ff3025cfed5c1ad9522fea38bfdb4cd12f0e11ae8c0f2e7483594ee115a6af06cfb3b5088d914a2a9
@@ -1,3 +1,10 @@
1
+ == 0.16.3
2
+
3
+ * Fixed a "stack level too deep" bug in mongoid #642 [bartes]
4
+
5
+ * Fixed a bug that Kaminari possibly crashes when combined with other gems
6
+ that define `inherited` method on model classes, such as aasm. #651 [zeitnot]
7
+
1
8
  == 0.16.2
2
9
 
3
10
  * Fixed a bug where cloned Relations remember previous relations'
@@ -3,16 +3,16 @@ require 'kaminari/models/active_record_model_extension'
3
3
  module Kaminari
4
4
  module ActiveRecordExtension
5
5
  extend ActiveSupport::Concern
6
- included do
6
+
7
+ module ClassMethods
7
8
  # Future subclasses will pick up the model extension
8
- class << self
9
- def inherited_with_kaminari(kls) #:nodoc:
10
- inherited_without_kaminari kls
11
- kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ::ActiveRecord::Base
12
- end
13
- alias_method_chain :inherited, :kaminari
9
+ def inherited(kls) #:nodoc:
10
+ super
11
+ kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ::ActiveRecord::Base
14
12
  end
13
+ end
15
14
 
15
+ included do
16
16
  # Existing subclasses pick up the model extension as well
17
17
  self.descendants.each do |kls|
18
18
  kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ::ActiveRecord::Base
@@ -13,13 +13,12 @@ module Kaminari
13
13
  include Kaminari::MongoidCriteriaMethods
14
14
  include Kaminari::PageScopeMethods
15
15
  end
16
+ end
16
17
 
17
- class << self
18
- def inherited_with_kaminari(kls)
19
- inherited_without_kaminari(kls)
20
- kls.send(:include, Kaminari::MongoidExtension::Document.dup)
21
- end
22
- alias_method_chain :inherited, :kaminari
18
+ module ClassMethods
19
+ def inherited(kls)
20
+ super
21
+ kls.send(:include, Kaminari::MongoidExtension::Document.dup)
23
22
  end
24
23
  end
25
24
  end
@@ -1,3 +1,3 @@
1
1
  module Kaminari
2
- VERSION = '0.16.2'
2
+ VERSION = '0.16.3'
3
3
  end
@@ -20,6 +20,10 @@ class Device < Product
20
20
  paginates_per 100
21
21
  end
22
22
 
23
+ class Android < Device
24
+ paginates_per 200
25
+ end
26
+
23
27
  class MongoMongoidExtensionDeveloper
24
28
  include ::Mongoid::Document
25
29
  field :salary, :type => Integer
@@ -1,4 +1,20 @@
1
- # Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
1
+ module Kaminari
2
+ module FakeGem
3
+ extend ActiveSupport::Concern
2
4
 
3
- class GemDefinedModel < ActiveRecord::Base
5
+ module ClassMethods
6
+ def inherited(kls)
7
+ super
8
+ def kls.fake_gem_defined_method; end
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ ActiveSupport.on_load :active_record do
15
+ ActiveRecord::Base.send :include, Kaminari::FakeGem
16
+
17
+ # Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
18
+ class GemDefinedModel < ActiveRecord::Base
19
+ end
4
20
  end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ if defined? ActiveRecord
4
+ describe Kaminari::ActiveRecordModelExtension do
5
+ subject { Class.new(ActiveRecord::Base) }
6
+ it { should respond_to :page }
7
+ it { should respond_to :fake_gem_defined_method }
8
+ end
9
+ end
@@ -31,10 +31,13 @@ if defined? ActiveRecord
31
31
  end
32
32
 
33
33
  describe Kaminari::ActiveRecordExtension do
34
- before do
35
- 1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
36
- 1.upto(100) {|i| GemDefinedModel.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
37
- 1.upto(100) {|i| Device.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
34
+ before :all do
35
+ [User, GemDefinedModel, Device].each do |m|
36
+ 1.upto(100) {|i| m.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
37
+ end
38
+ end
39
+ after :all do
40
+ [User, GemDefinedModel, Device].each {|m| m.delete_all }
38
41
  end
39
42
 
40
43
  [User, Admin, GemDefinedModel, Device].each do |model_class|
@@ -218,6 +218,11 @@ if defined? Mongoid
218
218
  subject { Device.all.page 1 }
219
219
  its(:limit_value) { should == 100 }
220
220
  end
221
+
222
+ context 'when paginates_per is defined in subclass of subclass' do
223
+ subject { Android.all.page 1 }
224
+ its(:limit_value) { should == 200 }
225
+ end
221
226
  end
222
227
  end
223
228
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.2
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-01-20 00:00:00.000000000 Z
14
+ date: 2015-02-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -259,6 +259,7 @@ files:
259
259
  - spec/helpers/sinatra_helpers_spec.rb
260
260
  - spec/helpers/tags_spec.rb
261
261
  - spec/models/active_record/active_record_relation_methods_spec.rb
262
+ - spec/models/active_record/inherited_spec.rb
262
263
  - spec/models/active_record/scopes_spec.rb
263
264
  - spec/models/array_spec.rb
264
265
  - spec/models/configuration_methods_spec.rb
@@ -317,6 +318,7 @@ test_files:
317
318
  - spec/helpers/sinatra_helpers_spec.rb
318
319
  - spec/helpers/tags_spec.rb
319
320
  - spec/models/active_record/active_record_relation_methods_spec.rb
321
+ - spec/models/active_record/inherited_spec.rb
320
322
  - spec/models/active_record/scopes_spec.rb
321
323
  - spec/models/array_spec.rb
322
324
  - spec/models/configuration_methods_spec.rb