提交 77bb0b79 编写于 作者: F Franck Verrot

Ordering with extra spaces was raising a SQL exception

上级 d33eb075
......@@ -311,6 +311,7 @@ def reverse_sql_order(order_query)
o.reverse
when String, Symbol
o.to_s.split(',').collect do |s|
s.strip!
s.gsub!(/\sasc\Z/i, ' DESC') || s.gsub!(/\sdesc\Z/i, ' ASC') || s.concat(' DESC')
end
else
......
......@@ -961,4 +961,8 @@ def test_eager_loading_with_conditions_on_joins
assert scope.eager_loading?
end
def test_ordering_with_extra_spaces
assert_equal authors(:david), Author.order('organization_id ASC , owned_essay_id DESC').last
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册