Class: IdentityCache::Cached::AttributeByMulti
- Defined in:
- lib/identity_cache/cached/attribute_by_multi.rb
Instance Attribute Summary
Attributes inherited from Attribute
#alias_name, #key_fields, #model, #unique
Instance Method Summary collapse
Methods inherited from Attribute
#attribute, #cache_encode, #cache_key, #expire, #fetch, #fetch_multi, #initialize, #load_multi_from_db, #load_one_from_db
Constructor Details
This class inherits a constructor from IdentityCache::Cached::Attribute
Instance Method Details
#build ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/identity_cache/cached/attribute_by_multi.rb', line 6 def build cached_attribute = self model.define_singleton_method(:"fetch_#{fetch_method_suffix}") do |*keys| raise_if_scoped cached_attribute.fetch(keys) end model.define_singleton_method(:"fetch_multi_#{fetch_method_suffix}") do |keys| raise_if_scoped cached_attribute.fetch_multi(keys) end end |