Skip to content

Commit fbd8a6e

Browse files
committed
Fixed The ORDER BY clause is invalid in views...
HasManyAssociationsTest#test_clearing_an_association_collection: HasManyAssociationsTest#test_clearing_without_initial_access: HasManyAssociationsTest#test_delete_all_with_not_yet_loaded_association_collection: HasManyAssociationsTest#test_deleting: HasManyAssociationsTest#test_deleting_a_collection: HasManyAssociationsTest#test_deleting_a_item_which_is_not_in_the_collection: HasManyAssociationsTest#test_transaction_when_deleting_persisted: HasManyAssociationsTest#test_transactions_when_replacing_on_persisted: HasManyAssociationsTest#test_update_all_on_association_accessed_before_save: PersistenceTest#test_update_all_ignores_order_without_limit_from_association: 69 failures, 34 errors, 2 skips
1 parent 50ac80d commit fbd8a6e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/arel/visitors/sqlserver.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ def visit_Arel_Nodes_Bin o, collector
2525
end
2626
end
2727

28+
def visit_Arel_Nodes_UpdateStatement(o, a)
29+
if o.orders.any? && o.limit.nil?
30+
o.limit = Nodes::Limit.new(9_223_372_036_854_775_807)
31+
end
32+
super
33+
end
34+
2835
def visit_Arel_Nodes_Lock o, collector
2936
o.expr = Arel.sql('WITH (UPDLOCK)') if o.expr.to_s =~ /FOR UPDATE/
3037
collector << SPACE

0 commit comments

Comments
 (0)