Module: PredictiveLoad::ActiveRecordCollectionObservation::AssociationNotification

Defined in:
lib/predictive_load/active_record_collection_observation.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



70
71
72
73
# File 'lib/predictive_load/active_record_collection_observation.rb', line 70

def self.included(base)
  base.send(:alias_method, :load_target_without_notification, :load_target)
  base.send(:alias_method, :load_target, :load_target_with_notification)
end

Instance Method Details

#load_target_with_notificationObject



75
76
77
78
79
# File 'lib/predictive_load/active_record_collection_observation.rb', line 75

def load_target_with_notification
  notify_collection_observer if find_target?

  load_target_without_notification
end