Method: ActiveRecord::Associations::Preloader::Association#initialize
- Defined in:
- activerecord/lib/active_record/associations/preloader/association.rb
#initialize(klass, owners, reflection, preload_scope, reflection_scope, associate_by_default) ⇒ Association
Returns a new instance of Association.
104 105 106 107 108 109 110 111 112 113 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 104 def initialize(klass, owners, reflection, preload_scope, reflection_scope, associate_by_default) @klass = klass @owners = owners.uniq(&:__id__) @reflection = reflection @preload_scope = preload_scope @reflection_scope = reflection_scope @associate = associate_by_default || !preload_scope || preload_scope.empty_scope? @model = owners.first && owners.first.class @run = false end |