From c9d82e25d0eb19fae043bb43a22cebee77790676 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 4 Jun 2024 15:51:19 -0700 Subject: [PATCH] Fixed error with Active Record main - closes #500 --- lib/pghero/methods/basic.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pghero/methods/basic.rb b/lib/pghero/methods/basic.rb index a17bca635..87b034bbd 100644 --- a/lib/pghero/methods/basic.rb +++ b/lib/pghero/methods/basic.rb @@ -42,7 +42,9 @@ def select_all(sql, conn: nil, query_columns: []) retries = 0 begin result = conn.select_all(add_source(squish(sql))) - if ActiveRecord::VERSION::STRING.to_f >= 6.1 + if ActiveRecord::VERSION::MAJOR >= 8 + result = result.to_a.map(&:symbolize_keys) + elsif ActiveRecord::VERSION::STRING.to_f >= 6.1 result = result.map(&:symbolize_keys) else result = result.map { |row| row.to_h { |col, val| [col.to_sym, result.column_types[col].send(:cast_value, val)] } }