jesjos / active_record_upsert

Upsert for Rails 5 / Active Record 5
MIT License
207 stars 51 forks source link

Add Rails 6.1 support #108

Closed ilvez closed 3 years ago

ilvez commented 3 years ago

An attempt to add Rails 6.1 support. I'm not really sure about the changes, just took e8972ce75c46bdeca7c59c7539550ac18bf522f4 as an example and made changes that seemed reasonable. Not sure about version specific compatibility need (using 'active_record_upsert/compatibility/rails60.rb'), but my local tests passed.

ilvez commented 3 years ago

So there is big requirements change in postgresql_adapter.rb in activerecord. https://github.com/rails/rails/commit/592358e182effecebe8c6a4645bd4431f5a73654

In 6.0.3.4 (activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb):

# Make sure we're using pg high enough for type casts and Ruby 2.2+ compatibility
gem "pg", ">= 0.18", "< 2.0"
require "pg"

In 6.1.0 (activerecord-6.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb):

gem "pg", "~> 1.1"
require "pg"