diff --git a/lib/mobility/plugins/active_record/query.rb b/lib/mobility/plugins/active_record/query.rb index 47717903..f21d59e8 100644 --- a/lib/mobility/plugins/active_record/query.rb +++ b/lib/mobility/plugins/active_record/query.rb @@ -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