Class: SmartCollection::Associations::Preloader::SmartCollectionCachedByTable
- Inherits:
-
ActiveRecord::Associations::Preloader::HasManyThrough
- Object
- ActiveRecord::Associations::Preloader::HasManyThrough
- SmartCollection::Associations::Preloader::SmartCollectionCachedByTable
- Defined in:
- lib/smart_collection/associations/preloader/smart_collection.rb
Instance Method Summary collapse
- #associated_records_by_owner(preloader) ⇒ Object
- #source_reflection ⇒ Object
- #through_reflection ⇒ Object
Instance Method Details
#associated_records_by_owner(preloader) ⇒ Object
14 15 16 17 |
# File 'lib/smart_collection/associations/preloader/smart_collection.rb', line 14 def associated_records_by_owner preloader owners.reject(&:cache_exists?).each(&:update_cache) super end |
#source_reflection ⇒ Object
9 10 11 12 |
# File 'lib/smart_collection/associations/preloader/smart_collection.rb', line 9 def source_reflection association_name = reflection.[:smart_collection].item_name through_reflection.klass.reflect_on_association(association_name) end |
#through_reflection ⇒ Object
5 6 7 |
# File 'lib/smart_collection/associations/preloader/smart_collection.rb', line 5 def through_reflection reflection.active_record.reflect_on_association(:cached_items) end |