1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

Merge pull request #1166 from activerecord-hackery/cleanups

Drop support for activerecord older than 5.2.4
This commit is contained in:
David Rodríguez 2020-11-20 15:42:30 +01:00 committed by GitHub
commit 3904335c76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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=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" ];

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)
* 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

View file

@ -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

View file

@ -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")