Module: PredictiveLoad::ActiveRecordCollectionObservation::RelationObservation
- Defined in:
- lib/predictive_load/active_record_collection_observation.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
12 13 14 15 |
# File 'lib/predictive_load/active_record_collection_observation.rb', line 12 def self.included(base) base.class_attribute :collection_observer base.alias_method_chain :to_a, :collection_observer end |
Instance Method Details
#to_a_with_collection_observer ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/predictive_load/active_record_collection_observation.rb', line 17 def to_a_with_collection_observer records = to_a_without_collection_observer if records.size > 1 && collection_observer collection_observer.observe(records.dup) end records end |