Sha256: 946dc56bb5e9344660809cccc6c1e01632d22a2833f21bee37bb744bb2f6d2eb

Contents?: true

Size: 653 Bytes

Versions: 15

Compression:

Stored size: 653 Bytes

Contents

module DbCharmer
  module ActiveRecord
    module Preloader
      module HasAndBelongsToMany
        extend ActiveSupport::Concern
        included do
          alias_method_chain :records_for, :db_magic
        end

        def records_for_with_db_magic(ids)
          if model.db_charmer_top_level_connection? || reflection.options[:polymorphic] ||
              model.db_charmer_default_connection != klass.db_charmer_default_connection
            records_for_without_db_magic(ids)
          else
            klass.on_db(model) do
              records_for_without_db_magic(ids)
            end
          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/has_and_belongs_to_many.rb
db-charmer-1.9.0 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.8.4 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.8.3 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.8.2 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.8.1 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.8.0 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.8.0.pre1 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
yam-db-charmer-1.7.4.14 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
yam-db-charmer-1.7.4.13 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
yam-db-charmer-1.7.4.10 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
yam-db-charmer-1.7.4.9 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
yam-db-charmer-1.7.4.8 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
yam-db-charmer-1.7.4.0 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb
db-charmer-1.7.1 lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb