-
-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1276 from activerecord-hackery/drop-rails-5.2-sup…
…port Drop rails 5.2 support
- Loading branch information
Showing
15 changed files
with
38 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb
This file was deleted.
Oops, something went wrong.
79 changes: 0 additions & 79 deletions
79
lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
21 changes: 20 additions & 1 deletion
21
lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
require 'polyamorous/activerecord_5.2_ruby_2/join_association' | ||
module Polyamorous | ||
module JoinAssociationExtensions | ||
include SwappingReflectionClass | ||
def self.prepended(base) | ||
base.class_eval { attr_reader :join_type } | ||
end | ||
|
||
def initialize(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin) | ||
@join_type = join_type | ||
if polymorphic_class && ::ActiveRecord::Base > polymorphic_class | ||
swapping_reflection_klass(reflection, polymorphic_class) do |reflection| | ||
super(reflection, children) | ||
self.reflection.options[:polymorphic] = true | ||
end | ||
else | ||
super(reflection, children) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
require 'polyamorous/activerecord_5.2_ruby_2/reflection' | ||
module Polyamorous | ||
module ReflectionExtensions | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters