Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
matrix:
ruby-version: ["3.3", "3.4", "4.0"]
active-record:
- { label: "7.2", env: "ACTIVE_RECORD_VERSION=~> 7.2.0" }
- { label: "8.0", env: "ACTIVE_RECORD_VERSION=~> 8.0.0" }
- { label: "8.1", env: "ACTIVE_RECORD_VERSION=~> 8.1.0" }
allow-failure: [false]
Expand All @@ -60,9 +59,6 @@ jobs:
- ruby-version: "4.0"
active-record: { label: "8-0-stable", env: "ACTIVE_RECORD_BRANCH=8-0-stable" }
allow-failure: true
- ruby-version: "4.0"
active-record: { label: "7-2-stable", env: "ACTIVE_RECORD_BRANCH=7-2-stable" }
allow-failure: true
- ruby-version: "ruby-head"
active-record: { label: "8.1", env: "ACTIVE_RECORD_VERSION=~> 8.1.0" }
allow-failure: true
Expand Down
2 changes: 1 addition & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ruby_version: 3.3
plugins:
- standard-performance
- standard-rails:
target_rails_version: 7.2
target_rails_version: 8.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# pg_search changelog

## Unreleased

* Drop support for Active Record 7.2

## 2.3.8

* Drop support for Ruby 3.0, 3.1, and 3.2
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Don't be discouraged if the maintainers ask you to change your code. We are alwa

Our automated tests start by updating all gems to their latest version. This is by design, because we want to be proactive about compatibility with other libraries. You can do the same by running `bundle update` at any time. To test against a specific version of Active Record, you can set the `ACTIVE_RECORD_VERSION` environment variable.

$ ACTIVE_RECORD_VERSION=5.0 bundle update
$ ACTIVE_RECORD_VERSION="~> 8.0.0" bundle update

Run the tests by running `bundle exec rake`, or `bin/rake` if you use Bundler binstubs.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Read the blog post introducing PgSearch at https://tanzu.vmware.com/content/blog
## REQUIREMENTS

- Ruby 3.3+
- Active Record 7.2+
- Active Record 8.0+
- PostgreSQL 9.2+
- [PostgreSQL extensions](https://github.com/Casecommons/pg_search/wiki/Installing-PostgreSQL-Extensions) for certain features

Expand Down
6 changes: 1 addition & 5 deletions lib/pg_search/migration/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ def read_sql_file(filename)
end

def migration_version
if ActiveRecord::VERSION::MAJOR >= 5
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
else
""
end
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
end
end
end
Expand Down
21 changes: 1 addition & 20 deletions lib/pg_search/scope_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,9 @@ def conditions
.reject { |_feature_name, feature_options| feature_options && feature_options[:sort_only] }
.map { |feature_name, _feature_options| feature_for(feature_name).conditions }

or_node(expressions)
Arel::Nodes::Or.new(expressions)
end

# https://github.com/rails/rails/pull/51492
# :nocov:
# standard:disable Lint/DuplicateMethods
or_arity = Arel::Nodes::Or.instance_method(:initialize).arity
case or_arity
when 1
def or_node(expressions)
Arel::Nodes::Or.new(expressions)
end
when 2
def or_node(expressions)
expressions.inject { |accumulator, expression| Arel::Nodes::Or.new(accumulator, expression) }
end
else
raise "Unsupported arity #{or_arity} for Arel::Nodes::Or#initialize"
end
# :nocov:
# standard:enable Lint/DuplicateMethods

def order_within_rank
config.order_within_rank || "#{primary_key} ASC"
end
Expand Down
4 changes: 2 additions & 2 deletions pg_search.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Gem::Specification.new do |s|
s.files = `git ls-files -z`.split("\x0")
s.require_paths = ["lib"]

s.add_dependency "activerecord", ">= 7.2"
s.add_dependency "activesupport", ">= 7.2"
s.add_dependency "activerecord", ">= 8.0"
s.add_dependency "activesupport", ">= 8.0"

s.required_ruby_version = ">= 3.3"
end
23 changes: 2 additions & 21 deletions spec/lib/pg_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@

require "spec_helper"

# For Active Record 5.x, the association reflection's cache needs be cleared
# because we're stubbing the related constants.
if ActiveRecord::VERSION::MAJOR == 5
def clear_searchable_cache
PgSearch::Document.reflect_on_association(:searchable).clear_association_scope_cache
end
else
def clear_searchable_cache
end
end

# standard:disable RSpec/NestedGroups
describe PgSearch do
describe ".multisearch" do
Expand All @@ -32,10 +21,7 @@ def clear_searchable_cache
end

context "with PgSearch.multisearch_options set to a Hash" do
subject do
clear_searchable_cache
described_class.multisearch(query).map(&:searchable)
end
subject { described_class.multisearch(query).map(&:searchable) }

before { allow(described_class).to receive(:multisearch_options).and_return(using: :dmetaphone) }

Expand All @@ -57,10 +43,7 @@ def clear_searchable_cache
end

context "with PgSearch.multisearch_options set to a Proc" do
subject do
clear_searchable_cache
described_class.multisearch(query, soundalike).map(&:searchable)
end
subject { described_class.multisearch(query, soundalike).map(&:searchable) }

before do
allow(described_class).to receive(:multisearch_options) do
Expand Down Expand Up @@ -169,7 +152,6 @@ def clear_searchable_cache

PgSearch::Multisearch.rebuild(SearchableSubclassModel)

clear_searchable_cache
expect(PgSearch::Document.count).to be 1
expect(PgSearch::Document.first.searchable.class).to be SearchableSubclassModel
expect(PgSearch::Document.first.searchable).to eq expected
Expand All @@ -184,7 +166,6 @@ def clear_searchable_cache
PgSearch::Multisearch.rebuild(SearchableSubclassModel)
expect(PgSearch::Document.count).to be 2

clear_searchable_cache
classes = PgSearch::Document.all.collect { |d| d.searchable.class }
expect(classes).to include SearchableSubclassModel
expect(classes).to include AnotherSearchableSubclassModel
Expand Down
Loading