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

Version Path
db-charmer-1.6.6 lib/db_charmer/association_preload.rb
db-charmer-1.6.5 lib/db_charmer/association_preload.rb
db-charmer-1.6.4 lib/db_charmer/association_preload.rb
db-charmer-1.6.3 lib/db_charmer/association_preload.rb
db-charmer-1.6.2 lib/db_charmer/association_preload.rb
db-charmer-1.6.1 lib/db_charmer/association_preload.rb
db-charmer-1.6.0 lib/db_charmer/association_preload.rb
db-charmer-1.5.5 lib/db_charmer/association_preload.rb
db-charmer-1.5.4 lib/db_charmer/association_preload.rb
db-charmer-1.5.3 lib/db_charmer/association_preload.rb
db-charmer-1.5.2 lib/db_charmer/association_preload.rb
db-charmer-1.5.1 lib/db_charmer/association_preload.rb
db-charmer-1.5.0 lib/db_charmer/association_preload.rb