Module: IdentityCache::QueryAPI::ClassMethods

Defined in:
lib/identity_cache/query_api.rb

Instance Method Summary collapse

Instance Method Details

#all_cached_associationsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
# File 'lib/identity_cache/query_api.rb', line 18

def all_cached_associations # :nodoc:
  cached_has_manys.merge(cached_has_ones).merge(cached_belongs_tos)
end

#cached_association(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/identity_cache/query_api.rb', line 13

def cached_association(name) # :nodoc:
  cached_has_manys[name] || cached_has_ones[name] || cached_belongs_tos.fetch(name)
end

#prefetch_associations(includes, records) ⇒ Object

Prefetches cached associations on a collection of records



8
9
10
# File 'lib/identity_cache/query_api.rb', line 8

def prefetch_associations(includes, records)
  Cached::Prefetcher.prefetch(self, includes, records)
end