Module: Concerns::Cacheable::ClassMethods
- Defined in:
- app/models/concerns/cacheable.rb
Instance Method Summary collapse
Instance Method Details
#cache_by(field) ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/models/concerns/cacheable.rb', line 17 def cache_by(field) @cache_field = field define_method(:flush_cache) do Rails.cache.delete [self.class.name, self.send(field), Rails.env] end end |