Sha256: f371f2da285be437e06eb1605d847a5d8d9e343cb702c22caaec18761dfe960d
Contents?: true
Size: 632 Bytes
Versions: 13
Compression:
Stored size: 632 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 = {}) return super(records, reflection, preload_options) if self.db_charmer_top_level_connection? reflection.klass.on_db(self) do super(records, reflection, preload_options) end end EOF end end end end
Version data entries
13 entries across 13 versions & 1 rubygems