Skip to content

Commit bfb30ab

Browse files
committed
Postgres, fix undefined decode_dates, just defining it fixes few tests
1 parent ce647ff commit bfb30ab

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/arjdbc/postgresql/adapter.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,15 @@ class PostgreSQLAdapter < AbstractAdapter
842842
# setting, you should immediately run <tt>bin/rails db:migrate</tt> to update the types in your schema.rb.
843843
class_attribute :datetime_type, default: :timestamp
844844

845+
##
846+
# :singleton-method:
847+
# Toggles automatic decoding of date columns.
848+
#
849+
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date").class #=> String
850+
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.decode_dates = true
851+
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date").class #=> Date
852+
class_attribute :decode_dates, default: false
853+
845854
# Try to use as much of the built in postgres logic as possible
846855
# maybe someday we can extend the actual adapter
847856
include ActiveRecord::ConnectionAdapters::PostgreSQL::ReferentialIntegrity

0 commit comments

Comments
 (0)