Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix sort key mappings. Closes #38.

  • Loading branch information...
commit ba4e60ef643aed429b870646eb11e20939520027 1 parent 7147e5c
@cheald cheald authored
View
2  lib/plucky/normalizers/options_hash_value.rb
@@ -66,7 +66,7 @@ def default_fields_value_normalizer
# Private
def default_sort_value_normalizer
- Normalizers::SortValue.new(:key_normalizer => Normalizers::HashKey.new({:_id => :id}))
+ Normalizers::SortValue.new(:key_normalizer => Normalizers::HashKey.new({:id => :_id}))
end
# Private
View
7 spec/functional/options_hash_spec.rb
@@ -10,6 +10,11 @@
subject[:order].should be_nil
end
+ it "changes sort(id) to sort(_id)" do
+ subject[:sort] = "id asc"
+ subject[:sort].should == [["_id", 1]]
+ end
+
it "changes select to fields" do
subject[:select] = [:foo]
subject[:fields].should == [:foo]
@@ -33,4 +38,4 @@
subject[:sort].should == [["order", 1]]
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.