Sha256: 8d87cf555d58f63c55e2cdd7f8cb5dc71ff2d69af155e5c377f9c2b286583f10
Contents?: true
Size: 825 Bytes
Versions: 11
Compression:
Stored size: 825 Bytes
Contents
module DbCharmer module AssociationPreload module ClassMethods ASSOCIATION_TYPES = [ :has_one, :has_many, :belongs_to, :has_and_belongs_to_many ] def self.extended(base) ASSOCIATION_TYPES.each do |association_type| base.class_eval <<-EOF, __FILE__, __LINE__ + 1 def self.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 end
Version data entries
11 entries across 11 versions & 1 rubygems