We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a7860cc commit b689b03Copy full SHA for b689b03
lib/arel/visitors/sqlserver.rb
@@ -170,7 +170,7 @@ def distinct_One_As_One_Is_So_Not_Fetch o
170
core = o.cores.first
171
distinct = Nodes::Distinct === core.set_quantifier
172
oneasone = core.projections.all? { |x| x == ActiveRecord::FinderMethods::ONE_AS_ONE }
173
- limitone = node_value(o.limit) == 1
+ limitone = [nil, 0, 1].include? node_value(o.limit)
174
if distinct && oneasone && limitone && !o.offset
175
core.projections = [Arel.sql("TOP(1) 1 AS [one]")]
176
o.limit = nil
0 commit comments