Sha256: f66d13c152a34b6d69e28845e6bd7a3d89aee9f84e73f079bd00ffe3bf9d028d
Contents?: true
Size: 836 Bytes
Versions: 2
Compression:
Stored size: 836 Bytes
Contents
require_relative 'preloader/association' unless Torque::PostgreSQL::AR521 module Torque module PostgreSQL module Associations module Preloader class BelongsToMany < ::ActiveRecord::Associations::Preloader::HasMany def association_key_name reflection.active_record_primary_key end def owner_key_name reflection.foreign_key end end def preloader_for(reflection, owners, *) return AlreadyLoaded \ if owners.first.association(reflection.name).loaded? return BelongsToMany \ if reflection.macro.eql?(:belongs_to_many) super end end ::ActiveRecord::Associations::Preloader.prepend(Preloader) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
torque-postgresql-1.1.8 | lib/torque/postgresql/associations/preloader.rb |
torque-postgresql-1.1.7 | lib/torque/postgresql/associations/preloader.rb |