Skip to content

Commit c76f0a7

Browse files
jukrashioyama
authored andcommitted
Fix broken count statements in ActiveRecord 8.0
1 parent 77eb039 commit c76f0a7

File tree

1 file changed

+1
-1
lines changed
  • lib/mobility/plugins/active_record

1 file changed

+1
-1
lines changed

lib/mobility/plugins/active_record/query.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def order(opts, *rest)
172172
base = keys.each_with_index.inject(self) do |query, (key, index)|
173173
next query unless klass.mobility_attribute?(key)
174174
keys[index] = backend_node(key)
175-
if method_name == "select"
175+
if method_name == "select" && query.order_values.any?
176176
keys[index] = keys[index]
177177
.as(::Mobility::Plugins::ActiveRecord::Query.attribute_alias(key.to_s))
178178
end

0 commit comments

Comments
 (0)