Skip to content
Browse files

handle symbols for order

  • Loading branch information...
1 parent 8002e25 commit 28e6c2744734468fc842ac7ffedd1a3b1250974f @binarylogic committed Apr 15, 2010
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/searchlogic/search.rb
  2. +5 −0 spec/searchlogic/search_spec.rb
View
2 lib/searchlogic/search.rb
@@ -99,7 +99,7 @@ def delete(*names)
# Returns the column we are currently ordering by
def ordering_by
- order && order.gsub(/^(ascend|descend)_by_/, '')
+ order && order.to_s.gsub(/^(ascend|descend)_by_/, '')
end
private
View
5 spec/searchlogic/search_spec.rb
@@ -350,6 +350,11 @@
search = User.search(:order => "descend_by_first_name")
search.ordering_by.should == "first_name"
end
+
+ it "should handle symbols" do
+ search = User.search(:order => :descend_by_first_name)
+ search.ordering_by.should == "first_name"
+ end
end
context "#method_missing" do

0 comments on commit 28e6c27

Please sign in to comment.
Something went wrong with that request. Please try again.