Skip to content

Commit

Permalink
fix last method
Browse files Browse the repository at this point in the history
  • Loading branch information
PNixx committed Sep 4, 2019
1 parent 872a42b commit 5070522
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/active_record/connection_adapters/clickhouse_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def clickhouse_connection(config)
end
end

module QueryMethods
class Relation

# Replace for only ClickhouseAdapter
def reverse_order!
orders = order_values.uniq
orders.reject!(&:blank?)
if self.connection.is_a?(ConnectionAdapters::ClickhouseAdapter) && orders.empty?
if self.connection.is_a?(ConnectionAdapters::ClickhouseAdapter) && orders.empty? && !primary_key
self.order_values = %w(date created_at).select {|c| column_names.include?(c) }.map{|c| arel_attribute(c).desc }
else
self.order_values = reverse_sql_order(orders)
Expand Down
2 changes: 1 addition & 1 deletion lib/clickhouse-activerecord/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ClickhouseActiverecord
VERSION = '0.3.7'
VERSION = '0.3.8'
end

0 comments on commit 5070522

Please sign in to comment.