Skip to content

Commit

Permalink
Fixed error with Active Record main - closes #500
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 4, 2024
1 parent 7965375 commit c9d82e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/pghero/methods/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)] } }
Expand Down

0 comments on commit c9d82e2

Please sign in to comment.