From 50705227b891d68573d468824653e6c7eb4cc46a Mon Sep 17 00:00:00 2001 From: nixx Date: Wed, 4 Sep 2019 16:08:51 +0300 Subject: [PATCH] fix last method --- lib/active_record/connection_adapters/clickhouse_adapter.rb | 4 ++-- lib/clickhouse-activerecord/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/active_record/connection_adapters/clickhouse_adapter.rb b/lib/active_record/connection_adapters/clickhouse_adapter.rb index 739c452a..554d2ce7 100644 --- a/lib/active_record/connection_adapters/clickhouse_adapter.rb +++ b/lib/active_record/connection_adapters/clickhouse_adapter.rb @@ -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) diff --git a/lib/clickhouse-activerecord/version.rb b/lib/clickhouse-activerecord/version.rb index 89b70ce7..dd7f9e9e 100644 --- a/lib/clickhouse-activerecord/version.rb +++ b/lib/clickhouse-activerecord/version.rb @@ -1,3 +1,3 @@ module ClickhouseActiverecord - VERSION = '0.3.7' + VERSION = '0.3.8' end