Drop support for activerecord older than 5.2.4

This commit is contained in:
David Rodríguez 2020-11-20 13:49:33 +01:00
parent cabaaf1e24
commit c6630ea567
No known key found for this signature in database
GPG Key ID: 1008A258BB37309C
4 changed files with 13 additions and 20 deletions

View File

@ -19,9 +19,9 @@ env:
- RAILS=5-2-stable DB=mysql - RAILS=5-2-stable DB=mysql
- RAILS=5-2-stable DB=postgres - RAILS=5-2-stable DB=postgres
- RAILS=v5.2.3 DB=sqlite3 - RAILS=v5.2.4 DB=sqlite3
- RAILS=v5.2.3 DB=mysql - RAILS=v5.2.4 DB=mysql
- RAILS=v5.2.3 DB=postgres - RAILS=v5.2.4 DB=postgres
before_script: before_script:
- if [ "$DB" = "mysql" ]; - if [ "$DB" = "mysql" ];

View File

@ -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) * 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 ## 2.3.2 - 2020-01-11
* Breakfix to bump Polyamorous * Breakfix to bump Polyamorous

View File

@ -1,20 +1,10 @@
module Polyamorous module Polyamorous
module ReflectionExtensions module ReflectionExtensions
if ActiveRecord.version > ::Gem::Version.new('5.2.3') def join_scope(table, foreign_table, foreign_klass)
def join_scope(table, foreign_table, foreign_klass) if respond_to?(:polymorphic?) && polymorphic?
if respond_to?(:polymorphic?) && polymorphic? super.where!(foreign_table[foreign_type].eq(klass.name))
super.where!(foreign_table[foreign_type].eq(klass.name)) else
else super
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
end end
end end
end end

View File

@ -14,8 +14,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.3' s.required_ruby_version = '>= 2.3'
s.license = 'MIT' s.license = 'MIT'
s.add_dependency 'activerecord', '>= 5.2.1' s.add_dependency 'activerecord', '>= 5.2.4'
s.add_dependency 'activesupport', '>= 5.2.1' s.add_dependency 'activesupport', '>= 5.2.4'
s.add_dependency 'i18n' s.add_dependency 'i18n'
s.files = `git ls-files`.split("\n") s.files = `git ls-files`.split("\n")