Skip to content

Commit

Permalink
Added support for Active Record 7
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Dec 7, 2021
1 parent 61145e1 commit 3dd0746
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
include:
- ruby: 3.0
gemfile: Gemfile
- ruby: 3.0
gemfile: gemfiles/activerecord70.gemfile
- ruby: 2.7
gemfile: gemfiles/activerecord60.gemfile
- ruby: 2.6
Expand All @@ -26,8 +28,8 @@ jobs:
database: neighbor_test
- run: bundle exec rake test
- run: |
sudo apt-get update && sudo apt-get install postgresql-server-dev-13
git clone --branch v0.1.8 https://github.com/ankane/pgvector.git
sudo apt-get update && sudo apt-get install postgresql-server-dev-14
git clone --branch v0.2.0 https://github.com/ankane/pgvector.git
cd pgvector
make
sudo make install
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.1 (unreleased)

- Added support for Active Record 7

## 0.2.0 (2021-04-21)

- Added support for pgvector
Expand Down
8 changes: 8 additions & 0 deletions gemfiles/activerecord70.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "activerecord", "~> 7.0.0.rc1"
gem "pg"
6 changes: 5 additions & 1 deletion lib/neighbor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ def initialize_type_map(m = type_map)
end

# prevent unknown OID warning
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(Neighbor::RegisterTypes)
if ActiveRecord::VERSION::MAJOR >= 7
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.singleton_class.prepend(Neighbor::RegisterTypes)
else
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(Neighbor::RegisterTypes)
end
end

0 comments on commit 3dd0746

Please sign in to comment.