will_paginate_mongoid 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/README.md +10 -10
- data/lib/will_paginate_mongoid/mongoid_paginator.rb +6 -1
- data/lib/will_paginate_mongoid/version.rb +1 -1
- metadata +21 -8
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
Will Paginate Mongoid
|
2
2
|
========
|
3
3
|
|
4
|
-
A simple gem that allows you use pagination
|
4
|
+
A simple gem that allows you to use pagination with Mongoid
|
5
5
|
---------------------------------------------------------------------
|
6
6
|
|
7
7
|
### Why use this gem?
|
8
8
|
|
9
|
-
Because will_paginate does not support mongoid `skip` and `limit` methods.
|
10
|
-
They just
|
11
|
-
Will_Paginate
|
12
|
-
|
9
|
+
Because will_paginate does not support the mongoid `skip` and `limit` methods.
|
10
|
+
They just support the `paginate` method in the `Array` class. What does this mean?
|
11
|
+
Will_Paginate will find all the objects and then cut out the unneeded ones.
|
12
|
+
This can cause performance problems when you have a lot of objects.
|
13
13
|
|
14
14
|
### How I install it?
|
15
15
|
|
16
|
-
|
16
|
+
Add `gem "will_paginate_mongoid"` to your `Gemfile` and run `bundle install`
|
17
17
|
|
18
18
|
or
|
19
19
|
|
@@ -21,9 +21,9 @@ Just run `gem install will_paginate_mongoid`
|
|
21
21
|
|
22
22
|
### How it works?
|
23
23
|
|
24
|
-
It just
|
25
|
-
and
|
24
|
+
It just creates a `paginate` method compatible with will_paginate interface
|
25
|
+
and adds two additional criteria: `skip` and `limit`
|
26
26
|
|
27
|
-
###
|
27
|
+
### That's it?
|
28
28
|
|
29
|
-
Yes. Now you can use `paginate` method like in [will_paginate documentation](https://github.com/mislav/will_paginate/wiki)
|
29
|
+
Yes. Now you can use the `paginate` method just like in the [will_paginate documentation](https://github.com/mislav/will_paginate/wiki)
|
@@ -13,11 +13,16 @@ module WillPaginateMongoid
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
|
17
|
+
def self.page(page)
|
18
|
+
paginate({page: page})
|
19
|
+
end
|
20
|
+
|
16
21
|
private
|
17
22
|
|
18
23
|
def self.base_options(options)
|
19
24
|
options[:page] ||= 1
|
20
|
-
options[:per_page] ||= 10
|
25
|
+
options[:per_page] ||= (WillPaginate.per_page || 10)
|
21
26
|
options[:offset] = (options[:page].to_i - 1) * options[:per_page].to_i
|
22
27
|
options
|
23
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: will_paginate_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
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:
|
12
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '2.4'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.4'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: will_paginate
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '3.0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
36
46
|
description: ''
|
37
47
|
email:
|
38
48
|
- lucasas@gmail.com
|
@@ -72,8 +82,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
82
|
version: '0'
|
73
83
|
requirements: []
|
74
84
|
rubyforge_project: will_paginate_mongoid
|
75
|
-
rubygems_version: 1.8.
|
85
|
+
rubygems_version: 1.8.24
|
76
86
|
signing_key:
|
77
87
|
specification_version: 3
|
78
88
|
summary: An extension that becomes possible use paginate method with Mongoid
|
79
|
-
test_files:
|
89
|
+
test_files:
|
90
|
+
- spec/fake_app.rb
|
91
|
+
- spec/integration/mongoid_paginator_spec.rb
|
92
|
+
- spec/spec_helper.rb
|