acts_as_ordinalized 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/acts_as_ordinalized.gemspec +1 -1
- data/lib/acts_as_ordinalized.rb +1 -1
- data/test/test_ordinalized.rb +7 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/acts_as_ordinalized.gemspec
CHANGED
data/lib/acts_as_ordinalized.rb
CHANGED
@@ -34,7 +34,7 @@ module ActsAsOrdinalized
|
|
34
34
|
collection_or_object.each_with_index do |item, index|
|
35
35
|
item.ordinal_number = ordinal_base + index
|
36
36
|
end
|
37
|
-
|
37
|
+
elsif !collection_or_object.nil?
|
38
38
|
collection_or_object.ordinal_number = ordinal_base
|
39
39
|
end
|
40
40
|
collection_or_object
|
data/test/test_ordinalized.rb
CHANGED
@@ -46,6 +46,13 @@ class OrdinalTest < Test::Unit::TestCase
|
|
46
46
|
even = Ordinal.all(:conditions => { :switch => true }, :order => "test_order ASC")
|
47
47
|
assert_equal [[2,1], [4,2]], even.map{|o| [o.test_order, o.ordinal_number] }
|
48
48
|
end
|
49
|
+
|
50
|
+
def test_nil_and_empty_results
|
51
|
+
empty = Ordinal.all(:conditions => ['test_order > 15'])
|
52
|
+
assert_equal [], empty
|
53
|
+
empty = Ordinal.last(:conditions => ['test_order > 15'])
|
54
|
+
assert_equal nil, empty
|
55
|
+
end
|
49
56
|
end
|
50
57
|
begin
|
51
58
|
require 'will_paginate'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_ordinalized
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- mandaryn
|