diff --git a/active_record/connection_adapters/postgresql/get_type_map.rb b/active_record/connection_adapters/postgresql/get_type_map.rb index e313e44..8f4d894 100644 --- a/active_record/connection_adapters/postgresql/get_type_map.rb +++ b/active_record/connection_adapters/postgresql/get_type_map.rb @@ -3,7 +3,11 @@ module ActiveRecord module ConnectionAdapters module PostgreSQL def get_type_map - type_map + if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR == 0 + ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::TYPE_MAP + else + type_map + end end end end diff --git a/lib/postgresql_cursor.rb b/lib/postgresql_cursor.rb index 2d3d2f9..faa58e7 100644 --- a/lib/postgresql_cursor.rb +++ b/lib/postgresql_cursor.rb @@ -8,5 +8,5 @@ require 'active_record' require 'active_record/connection_adapters/postgresql_adapter' ActiveRecord::Base.extend(PostgreSQLCursor::ActiveRecord::SqlCursor) -ActiveRecord::Relation.include(PostgreSQLCursor::ActiveRecord::Relation::CursorIterators) -ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(PostgreSQLCursor::ActiveRecord::ConnectionAdapters::PostgreSQLTypeMap) +ActiveRecord::Relation.send(:include, PostgreSQLCursor::ActiveRecord::Relation::CursorIterators) +ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, PostgreSQLCursor::ActiveRecord::ConnectionAdapters::PostgreSQLTypeMap) diff --git a/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb b/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb index ab4473b..d5cb8c4 100644 --- a/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb +++ b/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb @@ -5,7 +5,11 @@ module ConnectionAdapters module PostgreSQLTypeMap # Returns the private "type_map" needed for the cursor operation def get_type_map # :nodoc: - type_map + if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR == 0 + ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::TYPE_MAP + else + type_map + end end end end