Class: Memcacheable::FetchBelongsTo
- Inherits:
-
FetchAssociation
- Object
- Fetcher
- FetchAssociation
- Memcacheable::FetchBelongsTo
- Defined in:
- lib/memcacheable/fetch_belongs_to.rb
Instance Attribute Summary
Attributes inherited from FetchAssociation
Instance Method Summary collapse
Methods inherited from FetchAssociation
#cache_key, #class_name, #description, #initialize
Methods inherited from Fetcher
Constructor Details
This class inherits a constructor from Memcacheable::FetchAssociation
Instance Method Details
#find_on_cache_miss ⇒ Object
4 5 6 7 8 |
# File 'lib/memcacheable/fetch_belongs_to.rb', line 4 def find_on_cache_miss klass = association.to_s.camelize.constantize id = object.send "#{association}_id" klass.respond_to?(:fetch) ? klass.fetch(id) : klass.find(id) rescue nil end |