memorydb 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/memorydb/db.rb +3 -3
- metadata +1 -1
data/lib/memorydb/db.rb
CHANGED
@@ -177,9 +177,9 @@ module MemoryDb
|
|
177
177
|
|
178
178
|
def compare_model(model1, model2, sort)
|
179
179
|
field1, field2 = model1[sort.field], model2[sort.field]
|
180
|
-
field1 == field2
|
181
|
-
(field1.nil? ? true : (field1 < field2)) && sort.order == :asc ? -1 :
|
182
|
-
(field1.nil? ? false : (field1 > field2)) && sort.order == :desc ? -1 : 1
|
180
|
+
field1 == field2 ? nil :
|
181
|
+
(field1.nil? ? true : (field2.nil? ? false : (field1 < field2))) && sort.order == :asc ? -1 :
|
182
|
+
(field1.nil? ? false : (field2.nil? ? true : (field1 > field2))) && sort.order == :desc ? -1 : 1
|
183
183
|
end
|
184
184
|
|
185
185
|
def limit_models(models, limit)
|