diff options
Diffstat (limited to 'lib/gem_extensions/active_record/associations/preloader/through_association.rb')
-rw-r--r-- | lib/gem_extensions/active_record/associations/preloader/through_association.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/gem_extensions/active_record/associations/preloader/through_association.rb b/lib/gem_extensions/active_record/associations/preloader/through_association.rb new file mode 100644 index 00000000000..16b53846a58 --- /dev/null +++ b/lib/gem_extensions/active_record/associations/preloader/through_association.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module GemExtensions + module ActiveRecord + module Associations + module Preloader + module ThroughAssociation + extend ActiveSupport::Concern + + def through_scope + scope = through_reflection.klass.unscoped + options = reflection.options + + return scope if options[:disable_joins] + + super + end + end + end + end + end +end |