Sha256: eaaf6b3aebbfdbb5b9f6692f6ec8c2bd1a96fce2b16042890738dc683d3c5e98

Contents?: true

Size: 591 Bytes

Versions: 15

Compression:

Stored size: 591 Bytes

Contents

module DbCharmer
  module ActiveRecord
    module Preloader
      module Association
        extend ActiveSupport::Concern
        included do
          alias_method_chain :build_scope, :db_magic
        end

        def build_scope_with_db_magic
          if model.db_charmer_top_level_connection? || reflection.options[:polymorphic] ||
              model.db_charmer_default_connection != klass.db_charmer_default_connection
            build_scope_without_db_magic
          else
            build_scope_without_db_magic.on_db(model)
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
db-charmer-1.9.1 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.9.0 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.8.4 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.8.3 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.8.2 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.8.1 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.8.0 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.8.0.pre1 lib/db_charmer/rails31/active_record/preloader/association.rb
yam-db-charmer-1.7.4.14 lib/db_charmer/rails31/active_record/preloader/association.rb
yam-db-charmer-1.7.4.13 lib/db_charmer/rails31/active_record/preloader/association.rb
yam-db-charmer-1.7.4.10 lib/db_charmer/rails31/active_record/preloader/association.rb
yam-db-charmer-1.7.4.9 lib/db_charmer/rails31/active_record/preloader/association.rb
yam-db-charmer-1.7.4.8 lib/db_charmer/rails31/active_record/preloader/association.rb
yam-db-charmer-1.7.4.0 lib/db_charmer/rails31/active_record/preloader/association.rb
db-charmer-1.7.1 lib/db_charmer/rails31/active_record/preloader/association.rb