ransack 2.1.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +13 -1
  4. data/CHANGELOG.md +24 -0
  5. data/Gemfile +4 -12
  6. data/README.md +5 -3
  7. data/lib/ransack.rb +1 -0
  8. data/lib/ransack/adapters/active_record/context.rb +40 -12
  9. data/lib/ransack/adapters/active_record/ransack/constants.rb +5 -2
  10. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +1 -1
  11. data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -1
  12. data/lib/ransack/constants.rb +1 -0
  13. data/lib/ransack/context.rb +19 -18
  14. data/lib/ransack/helpers/form_helper.rb +1 -1
  15. data/lib/ransack/locale/az.yml +1 -1
  16. data/lib/ransack/locale/ca.yml +70 -0
  17. data/lib/ransack/locale/es.yml +22 -22
  18. data/lib/ransack/locale/fa.yml +70 -0
  19. data/lib/ransack/locale/fi.yml +71 -0
  20. data/lib/ransack/translate.rb +115 -115
  21. data/lib/ransack/version.rb +1 -1
  22. data/{lib → polyamorous/lib}/polyamorous.rb +7 -3
  23. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.0_ruby_2/join_association.rb +0 -0
  24. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb +0 -0
  25. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.1_ruby_2/join_association.rb +1 -2
  26. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb +0 -0
  27. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb +2 -3
  28. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb +1 -2
  29. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/reflection.rb +12 -0
  30. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb +0 -9
  31. data/{lib → polyamorous/lib}/polyamorous/activerecord_5.2.1_ruby_2/join_dependency.rb +25 -1
  32. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb +2 -0
  33. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +2 -0
  34. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +81 -0
  35. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +2 -0
  36. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +2 -0
  37. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +2 -0
  38. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +2 -0
  39. data/{lib → polyamorous/lib}/polyamorous/join.rb +0 -0
  40. data/{lib → polyamorous/lib}/polyamorous/swapping_reflection_class.rb +0 -0
  41. data/{lib → polyamorous/lib}/polyamorous/tree_node.rb +0 -0
  42. data/polyamorous/lib/polyamorous/version.rb +3 -0
  43. data/polyamorous/polyamorous.gemspec +35 -0
  44. data/ransack.gemspec +3 -3
  45. data/spec/helpers/polyamorous_helper.rb +6 -2
  46. data/spec/ransack/adapters/active_record/context_spec.rb +41 -0
  47. data/spec/ransack/join_dependency_spec.rb +18 -7
  48. data/spec/ransack/predicate_spec.rb +16 -2
  49. data/spec/ransack/search_spec.rb +26 -2
  50. data/spec/spec_helper.rb +1 -0
  51. data/spec/support/schema.rb +6 -0
  52. metadata +58 -18
@@ -1,3 +1,3 @@
1
1
  module Ransack
2
- VERSION = '2.1.1'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -12,13 +12,17 @@ if defined?(::ActiveRecord)
12
12
  require 'polyamorous/swapping_reflection_class'
13
13
 
14
14
  ar_version = ::ActiveRecord::VERSION::STRING[0,3]
15
- ar_version = ::ActiveRecord::VERSION::STRING[0,5] if ar_version >= "5.2"
16
- ar_version = "5.2.1" if ::ActiveRecord::VERSION::STRING >= "5.2.1"
17
-
15
+ ar_version = ::ActiveRecord::VERSION::STRING[0,5] if ar_version >= "5.2" && ::ActiveRecord.version < ::Gem::Version.new("6.0")
16
+ ar_version = "5.2.1" if ::ActiveRecord::VERSION::STRING >= "5.2.1" && ::ActiveRecord.version < ::Gem::Version.new("6.0")
18
17
  %w(join_association join_dependency).each do |file|
19
18
  require "polyamorous/activerecord_#{ar_version}_ruby_2/#{file}"
20
19
  end
21
20
 
21
+ if ar_version >= "5.2.0"
22
+ require "polyamorous/activerecord_#{ar_version}_ruby_2/reflection.rb"
23
+ ::ActiveRecord::Reflection::AbstractReflection.send(:prepend, Polyamorous::ReflectionExtensions)
24
+ end
25
+
22
26
  Polyamorous::JoinDependency.send(:prepend, Polyamorous::JoinDependencyExtensions)
23
27
  Polyamorous::JoinDependency.singleton_class.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods)
24
28
  Polyamorous::JoinAssociation.send(:prepend, Polyamorous::JoinAssociationExtensions)
@@ -7,8 +7,7 @@ module Polyamorous
7
7
  base.class_eval { attr_reader :join_type }
8
8
  end
9
9
 
10
- def initialize(reflection, children, polymorphic_class = nil,
11
- join_type = Arel::Nodes::InnerJoin)
10
+ def initialize(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
12
11
  @join_type = join_type
13
12
  if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
14
13
  swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
@@ -7,8 +7,7 @@ module Polyamorous
7
7
  base.class_eval { attr_reader :join_type }
8
8
  end
9
9
 
10
- def initialize(reflection, children, alias_tracker, polymorphic_class = nil,
11
- join_type = Arel::Nodes::InnerJoin)
10
+ def initialize(reflection, children, alias_tracker, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
12
11
  @join_type = join_type
13
12
  if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
14
13
  swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
@@ -23,7 +22,7 @@ module Polyamorous
23
22
  def build_constraint(klass, table, key, foreign_table, foreign_key)
24
23
  if reflection.polymorphic?
25
24
  super(klass, table, key, foreign_table, foreign_key)
26
- .and(foreign_table[reflection.foreign_type].eq(reflection.klass.name))
25
+ .and(foreign_table[reflection.foreign_type].eq(reflection.klass.name))
27
26
  else
28
27
  super(klass, table, key, foreign_table, foreign_key)
29
28
  end
@@ -38,7 +38,6 @@ module Polyamorous
38
38
  # passing an additional argument, `join_type`, to #join_constraints.
39
39
  #
40
40
  def join_constraints(outer_joins, join_type)
41
- @alias_tracker = alias_tracker
42
41
  joins = join_root.children.flat_map { |child|
43
42
  if join_type == Arel::Nodes::OuterJoin
44
43
  make_polyamorous_left_outer_joins join_root, child
@@ -48,7 +47,7 @@ module Polyamorous
48
47
  }
49
48
 
50
49
  joins.concat outer_joins.flat_map { |oj|
51
- if join_root.match? oj.join_root
50
+ if join_root.match?(oj.join_root) && join_root.table.name == oj.join_root.table.name
52
51
  walk(join_root, oj.join_root)
53
52
  else
54
53
  oj.join_root.children.flat_map { |child|
@@ -0,0 +1,12 @@
1
+ module Polyamorous
2
+ module ReflectionExtensions
3
+ def build_join_constraint(table, foreign_table)
4
+ if polymorphic?
5
+ super(table, foreign_table)
6
+ .and(foreign_table[foreign_type].eq(klass.name))
7
+ else
8
+ super(table, foreign_table)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -18,14 +18,5 @@ module Polyamorous
18
18
  super(reflection, children)
19
19
  end
20
20
  end
21
-
22
- def build_constraint(klass, table, key, foreign_table, foreign_key)
23
- if reflection.polymorphic?
24
- super(klass, table, key, foreign_table, foreign_key)
25
- .and(foreign_table[reflection.foreign_type].eq(reflection.klass.name))
26
- else
27
- super(klass, table, key, foreign_table, foreign_key)
28
- end
29
- end
30
21
  end
31
22
  end
@@ -3,7 +3,6 @@
3
3
  module Polyamorous
4
4
  module JoinDependencyExtensions
5
5
  # Replaces ActiveRecord::Associations::JoinDependency#build
6
- #
7
6
  def build(associations, base_klass)
8
7
  associations.map do |name, right|
9
8
  if name.is_a? Join
@@ -30,6 +29,31 @@ module Polyamorous
30
29
  end
31
30
  end
32
31
 
32
+ def join_constraints(joins_to_add, join_type, alias_tracker)
33
+ @alias_tracker = alias_tracker
34
+
35
+ construct_tables!(join_root)
36
+ joins = make_join_constraints(join_root, join_type)
37
+
38
+ joins.concat joins_to_add.flat_map { |oj|
39
+ construct_tables!(oj.join_root)
40
+ if join_root.match?(oj.join_root) && join_root.table.name == oj.join_root.table.name
41
+ walk join_root, oj.join_root
42
+ else
43
+ make_join_constraints(oj.join_root, join_type)
44
+ end
45
+ }
46
+ end
47
+
48
+ private
49
+ def make_constraints(parent, child, join_type = Arel::Nodes::OuterJoin)
50
+ foreign_table = parent.table
51
+ foreign_klass = parent.base_klass
52
+ join_type = child.join_type || join_type if join_type == Arel::Nodes::InnerJoin
53
+ joins = child.join_constraints(foreign_table, foreign_klass, join_type, alias_tracker)
54
+ joins.concat child.children.flat_map { |c| make_constraints(child, c, join_type) }
55
+ end
56
+
33
57
  module ClassMethods
34
58
  # Prepended before ActiveRecord::Associations::JoinDependency#walk_tree
35
59
  #
@@ -0,0 +1,2 @@
1
+ # active_record_5.2.1_ruby_2/reflection.rb
2
+ require 'polyamorous/activerecord_5.2.0_ruby_2/reflection'
@@ -0,0 +1,2 @@
1
+ # active_record_6.0_ruby_2/join_association
2
+ require 'polyamorous/activerecord_5.2.1_ruby_2/join_association'
@@ -0,0 +1,81 @@
1
+ # active_record_6.0_ruby_2/join_dependency.rb
2
+
3
+ module Polyamorous
4
+ module JoinDependencyExtensions
5
+ # Replaces ActiveRecord::Associations::JoinDependency#build
6
+ def build(associations, base_klass)
7
+ associations.map do |name, right|
8
+ if name.is_a? Join
9
+ reflection = find_reflection base_klass, name.name
10
+ reflection.check_validity!
11
+ reflection.check_eager_loadable!
12
+
13
+ klass = if reflection.polymorphic?
14
+ name.klass || base_klass
15
+ else
16
+ reflection.klass
17
+ end
18
+ JoinAssociation.new(reflection, build(right, klass), name.klass, name.type)
19
+ else
20
+ reflection = find_reflection base_klass, name
21
+ reflection.check_validity!
22
+ reflection.check_eager_loadable!
23
+
24
+ if reflection.polymorphic?
25
+ raise ActiveRecord::EagerLoadPolymorphicError.new(reflection)
26
+ end
27
+ JoinAssociation.new(reflection, build(right, reflection.klass))
28
+ end
29
+ end
30
+ end
31
+
32
+ def join_constraints(joins_to_add, alias_tracker)
33
+ @alias_tracker = alias_tracker
34
+
35
+ construct_tables!(join_root)
36
+ joins = make_join_constraints(join_root, join_type)
37
+
38
+ joins.concat joins_to_add.flat_map { |oj|
39
+ construct_tables!(oj.join_root)
40
+ if join_root.match?(oj.join_root) && join_root.table.name == oj.join_root.table.name
41
+ walk join_root, oj.join_root, oj.join_type
42
+ else
43
+ make_join_constraints(oj.join_root, oj.join_type)
44
+ end
45
+ }
46
+ end
47
+
48
+ private
49
+ def make_constraints(parent, child, join_type = Arel::Nodes::OuterJoin)
50
+ foreign_table = parent.table
51
+ foreign_klass = parent.base_klass
52
+ join_type = child.join_type || join_type if join_type == Arel::Nodes::InnerJoin
53
+ joins = child.join_constraints(foreign_table, foreign_klass, join_type, alias_tracker)
54
+ joins.concat child.children.flat_map { |c| make_constraints(child, c, join_type) }
55
+ end
56
+
57
+ module ClassMethods
58
+ # Prepended before ActiveRecord::Associations::JoinDependency#walk_tree
59
+ #
60
+ def walk_tree(associations, hash)
61
+ case associations
62
+ when TreeNode
63
+ associations.add_to_tree(hash)
64
+ when Hash
65
+ associations.each do |k, v|
66
+ cache =
67
+ if TreeNode === k
68
+ k.add_to_tree(hash)
69
+ else
70
+ hash[k] ||= {}
71
+ end
72
+ walk_tree(v, cache)
73
+ end
74
+ else
75
+ super(associations, hash)
76
+ end
77
+ end
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,2 @@
1
+ # active_record_6.0_ruby_2/reflection.rb
2
+ require 'polyamorous/activerecord_5.2.0_ruby_2/reflection'
@@ -0,0 +1,2 @@
1
+ # active_record_6.1_ruby_2/join_association
2
+ require 'polyamorous/activerecord_6.0_ruby_2/join_association'
@@ -0,0 +1,2 @@
1
+ # active_record_6.1_ruby_2/join_dependency.rb
2
+ require 'polyamorous/activerecord_6.0_ruby_2/join_dependency'
@@ -0,0 +1,2 @@
1
+ # active_record_6.1_ruby_2/reflection.rb
2
+ require 'polyamorous/activerecord_6.0_ruby_2/reflection'
@@ -0,0 +1,3 @@
1
+ module Polyamorous
2
+ VERSION = '2.3.0'
3
+ end
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "polyamorous/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "polyamorous"
7
+ s.version = Polyamorous::VERSION
8
+ s.authors = ["Ernie Miller", "Ryan Bigg", "Jon Atack", "Xiang Li"]
9
+ s.email = ["ernie@erniemiller.org", "radarlistener@gmail.com", "jonnyatack@gmail.com", "bigxiang@gmail.com"]
10
+ s.homepage = "https://github.com/activerecord-hackery/ransack/tree/master/polyamorous"
11
+ s.license = "MIT"
12
+ s.summary = %q{
13
+ Loves/is loved by polymorphic belongs_to associations, Ransack, Squeel, MetaSearch...
14
+ }
15
+ s.description = %q{
16
+ This is just an extraction from Ransack/Squeel. You probably don't want to use this
17
+ directly. It extends ActiveRecord's associations to support polymorphic belongs_to
18
+ associations.
19
+ }
20
+
21
+ s.add_dependency 'activerecord', '>= 5.0'
22
+ s.add_development_dependency 'rspec', '~> 3'
23
+ s.add_development_dependency 'machinist', '~> 1.0.6'
24
+ s.add_development_dependency 'faker', '~> 1.6.5'
25
+ s.add_development_dependency 'sqlite3', '~> 1.3.3'
26
+
27
+ s.files = `git ls-files`.split("\n")
28
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
+ s.require_paths = ["lib"]
31
+
32
+ # specify any dependencies here; for example:
33
+ # s.add_development_dependency "rspec"
34
+ # s.add_runtime_dependency "rest-client"
35
+ end
@@ -14,19 +14,19 @@ Gem::Specification.new do |s|
14
14
  s.required_ruby_version = '>= 1.9'
15
15
  s.license = 'MIT'
16
16
 
17
- s.rubyforge_project = "ransack"
18
-
19
17
  s.add_dependency 'actionpack', '>= 5.0'
20
18
  s.add_dependency 'activerecord', '>= 5.0'
21
19
  s.add_dependency 'activesupport', '>= 5.0'
22
20
  s.add_dependency 'i18n'
21
+ s.add_dependency 'polyamorous', Ransack::VERSION.to_s
23
22
  s.add_development_dependency 'rspec', '~> 3'
24
23
  s.add_development_dependency 'machinist', '~> 1.0.6'
25
24
  s.add_development_dependency 'faker', '~> 0.9.5'
26
- s.add_development_dependency 'sqlite3', '~> 1.3.3'
25
+ s.add_development_dependency 'sqlite3', ::Gem::Version.new(ENV['RAILS'].gsub(/^v/, '')) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3'
27
26
  s.add_development_dependency 'pg', '~> 0.21'
28
27
  s.add_development_dependency 'mysql2', '0.3.20'
29
28
  s.add_development_dependency 'pry', '0.10'
29
+ s.add_development_dependency 'byebug'
30
30
 
31
31
  s.files = `git ls-files`.split("\n")
32
32
 
@@ -3,11 +3,15 @@ module PolyamorousHelper
3
3
  Polyamorous::JoinAssociation.new reflection, children, klass
4
4
  end
5
5
 
6
- if ActiveRecord::VERSION::STRING > "5.2.0"
6
+ if ActiveRecord.version >= ::Gem::Version.new("6.0.0.rc1")
7
+ def new_join_dependency(klass, associations = {})
8
+ Polyamorous::JoinDependency.new klass, klass.arel_table, associations, Polyamorous::InnerJoin
9
+ end
10
+ elsif ActiveRecord.version > ::Gem::Version.new("5.2.0")
7
11
  def new_join_dependency(klass, associations = {})
8
12
  Polyamorous::JoinDependency.new klass, klass.arel_table, associations
9
13
  end
10
- elsif ActiveRecord::VERSION::STRING == "5.2.0"
14
+ elsif ActiveRecord.version == ::Gem::Version.new("5.2.0")
11
15
  def new_join_dependency(klass, associations = {})
12
16
  alias_tracker = ::ActiveRecord::Associations::AliasTracker.create(klass.connection, klass.table_name, [])
13
17
  Polyamorous::JoinDependency.new klass, klass.arel_table, associations, alias_tracker
@@ -40,6 +40,47 @@ module Ransack
40
40
  end
41
41
  end
42
42
 
43
+ describe '#build_correlated_subquery' do
44
+ it 'build correlated subquery for Root STI model' do
45
+ search = Search.new(Person, { articles_title_not_eq: 'some_title' }, context: subject)
46
+ attribute = search.conditions.first.attributes.first
47
+ constraints = subject.build_correlated_subquery(attribute.parent).constraints
48
+ constraint = constraints.first
49
+
50
+ expect(constraints.length).to eql 1
51
+ expect(constraint.left.name).to eql 'person_id'
52
+ expect(constraint.left.relation.name).to eql 'articles'
53
+ expect(constraint.right.name).to eql 'id'
54
+ expect(constraint.right.relation.name).to eql 'people'
55
+ end
56
+
57
+ it 'build correlated subquery for Child STI model when predicate is not_eq' do
58
+ search = Search.new(Person, { story_articles_title_not_eq: 'some_title' }, context: subject)
59
+ attribute = search.conditions.first.attributes.first
60
+ constraints = subject.build_correlated_subquery(attribute.parent).constraints
61
+ constraint = constraints.first
62
+
63
+ expect(constraints.length).to eql 1
64
+ expect(constraint.left.relation.name).to eql 'articles'
65
+ expect(constraint.left.name).to eql 'person_id'
66
+ expect(constraint.right.relation.name).to eql 'people'
67
+ expect(constraint.right.name).to eql 'id'
68
+ end
69
+
70
+ it 'build correlated subquery for Child STI model when predicate is eq' do
71
+ search = Search.new(Person, { story_articles_title_not_eq: 'some_title' }, context: subject)
72
+ attribute = search.conditions.first.attributes.first
73
+ constraints = subject.build_correlated_subquery(attribute.parent).constraints
74
+ constraint = constraints.first
75
+
76
+ expect(constraints.length).to eql 1
77
+ expect(constraint.left.relation.name).to eql 'articles'
78
+ expect(constraint.left.name).to eql 'person_id'
79
+ expect(constraint.right.relation.name).to eql 'people'
80
+ expect(constraint.right.name).to eql 'id'
81
+ end
82
+ end
83
+
43
84
  describe 'sharing context across searches' do
44
85
  let(:shared_context) { Context.for(Person) }
45
86
 
@@ -8,8 +8,8 @@ module Polyamorous
8
8
 
9
9
  specify { expect(subject.send(:join_root).drop(1).size)
10
10
  .to eq(2) }
11
- specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
12
- .to be_all { Polyamorous::InnerJoin } }
11
+ specify { expect(subject.send(:join_root).drop(1).map(&:join_type).uniq)
12
+ .to eq [Polyamorous::InnerJoin] }
13
13
  end
14
14
 
15
15
  context 'with has_many :through association' do
@@ -38,8 +38,8 @@ module Polyamorous
38
38
  .to eq 2 }
39
39
  specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
40
40
  .to eq [Polyamorous::OuterJoin, Polyamorous::OuterJoin] }
41
- specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
42
- .to be_all { Polyamorous::OuterJoin } }
41
+ specify { expect(subject.send(:join_root).drop(1).map(&:join_type).uniq)
42
+ .to eq [Polyamorous::OuterJoin] }
43
43
  end
44
44
 
45
45
  context 'with polymorphic belongs_to join' do
@@ -59,8 +59,19 @@ module Polyamorous
59
59
 
60
60
  specify { expect(subject.send(:join_root).drop(1).size)
61
61
  .to eq 2 }
62
- specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
63
- .to be_all { Polyamorous::InnerJoin } }
62
+ specify { expect(subject.send(:join_root).drop(1).map(&:join_type).uniq)
63
+ .to eq [Polyamorous::InnerJoin] }
64
+ specify { expect(subject.send(:join_root).drop(1).first.table_name)
65
+ .to eq 'people' }
66
+ specify { expect(subject.send(:join_root).drop(1)[1].table_name)
67
+ .to eq 'comments' }
68
+ end
69
+
70
+ context 'with polymorphic belongs_to join and nested join' do
71
+ subject { new_join_dependency Note,
72
+ new_join(:notable, :outer, Person) => :comments }
73
+ specify { expect(subject.send(:join_root).drop(1).size).to eq 2 }
74
+ specify { expect(subject.send(:join_root).drop(1).map(&:join_type)).to eq [Polyamorous::OuterJoin, Polyamorous::InnerJoin] }
64
75
  specify { expect(subject.send(:join_root).drop(1).first.table_name)
65
76
  .to eq 'people' }
66
77
  specify { expect(subject.send(:join_root).drop(1)[1].table_name)
@@ -68,7 +79,7 @@ module Polyamorous
68
79
  end
69
80
 
70
81
  context '#left_outer_join in Rails 5 overrides join type specified',
71
- if: ActiveRecord::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR < 2 do
82
+ if: ActiveRecord::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MAJOR < 6 && ActiveRecord::VERSION::MINOR < 2 do
72
83
 
73
84
  let(:join_type_class) do
74
85
  new_join_dependency(