Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for activerecord older than 5.2.4 #1166

Merged
merged 1 commit into from
Nov 20, 2020
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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ env:
- RAILS=5-2-stable DB=mysql
- RAILS=5-2-stable DB=postgres

- RAILS=v5.2.3 DB=sqlite3
- RAILS=v5.2.3 DB=mysql
- RAILS=v5.2.3 DB=postgres
- RAILS=v5.2.4 DB=sqlite3
- RAILS=v5.2.4 DB=mysql
- RAILS=v5.2.4 DB=postgres

before_script:
- if [ "$DB" = "mysql" ];
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

* Fix for ActiveRecord 5.2.4 (note security fix in 5.2.4.2 for ActiveView's escape_javascript CVE-2020-5267 for all earlier versions)

* Drop support for ActiveRecord older than 5.2.4.
PR [1166](https://github.com/activerecord-hackery/ransack/pull/1166)

## 2.3.2 - 2020-01-11

* Breakfix to bump Polyamorous
Expand Down
20 changes: 5 additions & 15 deletions lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
module Polyamorous
module ReflectionExtensions
if ActiveRecord.version > ::Gem::Version.new('5.2.3')
def join_scope(table, foreign_table, foreign_klass)
if respond_to?(:polymorphic?) && polymorphic?
super.where!(foreign_table[foreign_type].eq(klass.name))
else
super
end
end
else
def build_join_constraint(table, foreign_table)
if polymorphic?
super.and(foreign_table[foreign_type].eq(klass.name))
else
super
end
def join_scope(table, foreign_table, foreign_klass)
if respond_to?(:polymorphic?) && polymorphic?
super.where!(foreign_table[foreign_type].eq(klass.name))
else
super
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions ransack.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.3'
s.license = 'MIT'

s.add_dependency 'activerecord', '>= 5.2.1'
s.add_dependency 'activesupport', '>= 5.2.1'
s.add_dependency 'activerecord', '>= 5.2.4'
s.add_dependency 'activesupport', '>= 5.2.4'
s.add_dependency 'i18n'

s.files = `git ls-files`.split("\n")
Expand Down