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.



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

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.



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

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



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

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