Skip to content

Commit

Permalink
Fix broken count statements in ActiveRecord 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jukra authored and shioyama committed Nov 30, 2024
1 parent 77eb039 commit c76f0a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mobility/plugins/active_record/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def order(opts, *rest)
base = keys.each_with_index.inject(self) do |query, (key, index)|
next query unless klass.mobility_attribute?(key)
keys[index] = backend_node(key)
if method_name == "select"
if method_name == "select" && query.order_values.any?
keys[index] = keys[index]
.as(::Mobility::Plugins::ActiveRecord::Query.attribute_alias(key.to_s))
end
Expand Down

0 comments on commit c76f0a7

Please sign in to comment.