kaminari 0.10.3 → 0.10.4

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.

data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.10.4
2
+
3
+ * Do not break ActiveRecord::Base.descendants, by making sure to call super
4
+ from ActiveRecord::Base.inherited #34 [rolftimmermans]
5
+
6
+ * Fixed vanishing mongoid criteria after calling page() #26 [tyok]
7
+
1
8
  == 0.10.3
2
9
 
3
10
  * Fixed a bug that total_count() didn't work when chained with group() scope
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.3
1
+ 0.10.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kaminari}
8
- s.version = "0.10.3"
8
+ s.version = "0.10.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Akira Matsuda"]
12
- s.date = %q{2011-02-23}
12
+ s.date = %q{2011-02-24}
13
13
  s.description = %q{Kaminari is a Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3}
14
14
  s.email = %q{ronnie@dio.jp}
15
15
  s.extra_rdoc_files = [
@@ -24,6 +24,8 @@ module Kaminari
24
24
  include Kaminari::PageScopeMethods
25
25
  end
26
26
  end
27
+
28
+ super
27
29
  end
28
30
  end
29
31
  end
@@ -5,7 +5,9 @@ module Kaminari
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- delegate :page, :per, :num_pages, :current_page, :limit_value, :offset_value, :pagination_count, :to => '@klass'
8
+ def page(*args)
9
+ self.klass.page(*args).criteria.merge(self)
10
+ end
9
11
  end
10
12
  end
11
13
 
@@ -6,6 +6,7 @@ describe Kaminari::MongoidExtension do
6
6
  before :all do
7
7
  class Developer
8
8
  include ::Mongoid::Document
9
+ field :salary, :type => Integer
9
10
  end
10
11
  end
11
12
  before do
@@ -39,6 +40,25 @@ describe Kaminari::MongoidExtension do
39
40
  its(:num_pages) { should == 12 }
40
41
  it { should skip 0 }
41
42
  end
43
+
44
+ context 'with criteria before' do
45
+ subject { Developer.where(:salary => 1).page 2 }
46
+ its(:selector) { should == {:salary => 1} }
47
+ its(:current_page) { should == 2 }
48
+ its(:limit_value) { should == 25 }
49
+ its(:num_pages) { should == 12 }
50
+ it { should skip 25 }
51
+ end
52
+
53
+ context 'with criteria after' do
54
+ subject { Developer.page(2).where(:salary => 1) }
55
+ its(:selector) { should == {:salary => 1} }
56
+ its(:current_page) { should == 2 }
57
+ its(:limit_value) { should == 25 }
58
+ its(:num_pages) { should == 12 }
59
+ it { should skip 25 }
60
+ end
61
+
42
62
  end
43
63
 
44
64
  describe '#per' do
@@ -101,4 +101,9 @@ describe Kaminari::ActiveRecordExtension do
101
101
  its(:total_count) { should == 11 }
102
102
  its(:num_pages) { should == 3 }
103
103
  end
104
+
105
+ context 'activerecord descendants' do
106
+ subject { ActiveRecord::Base.descendants }
107
+ its(:length) { should_not == 0 }
108
+ end
104
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 3
10
- version: 0.10.3
9
+ - 4
10
+ version: 0.10.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akira Matsuda
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-23 00:00:00 +09:00
18
+ date: 2011-02-24 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency