Sha256: 76ca73d993dadc7b71d5fbe0bf34e9bebd7ed87af9c8c70db2eca3484eb1483e
Contents?: true
Size: 750 Bytes
Versions: 2
Compression:
Stored size: 750 Bytes
Contents
module DbCharmer module AssociationPreload module ClassMethods ASSOCIATION_TYPES = [ :has_one, :has_many, :belongs_to, :has_and_belongs_to_many ] ASSOCIATION_TYPES.each do |association_type| class_eval <<-EOF, __FILE__, __LINE__ + 1 def preload_#{association_type}_association(records, reflection, preload_options = {}) if self.db_charmer_top_level_connection? || self.db_charmer_default_connection != reflection.klass.db_charmer_default_connection return super(records, reflection, preload_options) end reflection.klass.on_db(self) do super(records, reflection, preload_options) end end EOF end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
db-charmer-1.6.8 | lib/db_charmer/association_preload.rb |
db-charmer-1.6.7 | lib/db_charmer/association_preload.rb |