Skip to content

Commit

Permalink
Drop support for activerecord older than 5.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Nov 20, 2020
1 parent cabaaf1 commit c6630ea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
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

0 comments on commit c6630ea

Please sign in to comment.