Module: DbCharmer::ActiveRecord::Preloader::HasAndBelongsToMany

Extended by:
ActiveSupport::Concern
Defined in:
lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb

Instance Method Summary collapse

Instance Method Details

#records_for_with_db_magic(ids) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/db_charmer/rails31/active_record/preloader/has_and_belongs_to_many.rb', line 10

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