module ArLazyPreload::CollectionAssociation
ActiveRecord::CollectionAssociation patch with a hook for lazy preloading
Public Instance Methods
ids_reader()
click to toggle source
rubocop:disable Metrics/AbcSize
Calls superclass method
# File lib/ar_lazy_preload/active_record/collection_association.rb, line 7 def ids_reader return super if owner.lazy_preload_context.blank? primary_key = reflection.association_primary_key.to_sym if loaded? target.map(&primary_key) elsif !target.empty? load_target.map(&primary_key) else @association_ids ||= reader.map(&primary_key) end end