simple_record 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_record.rb +7 -6
- metadata +3 -3
data/lib/simple_record.rb
CHANGED
@@ -876,15 +876,16 @@ module SimpleRecord
|
|
876
876
|
|
877
877
|
# This gets less and less efficient the higher the page since SimpleDB has no way
|
878
878
|
# to start at a specific row. So it will iterate from the first record and pull out the specific pages.
|
879
|
-
|
879
|
+
def self.paginate(options={})
|
880
880
|
# options = args.pop
|
881
881
|
# puts 'paginate options=' + options.inspect if SimpleRecord.logging?
|
882
|
-
page = options[:page]
|
883
|
-
per_page = options[:per_page]
|
882
|
+
page = options[:page] || 1
|
883
|
+
per_page = options[:per_page] || 50
|
884
884
|
# total = options[:total_entries].to_i
|
885
|
-
options[:page] = page # makes sure it's to_i
|
886
|
-
options[:per_page] = per_page
|
887
|
-
options[:limit] = page * per_page
|
885
|
+
options[:page] = page.to_i # makes sure it's to_i
|
886
|
+
options[:per_page] = per_page.to_i
|
887
|
+
options[:limit] = options[:page] * options[:per_page]
|
888
|
+
# puts 'paging options=' + options.inspect
|
888
889
|
fr = find(:all, options)
|
889
890
|
return fr
|
890
891
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 7
|
10
|
+
version: 1.3.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Travis Reeder
|