Module: ActiveRecordCaching::CacheSerializing
- Defined in:
- lib/active_record_caching/cache_serializing.rb
Instance Method Summary collapse
Instance Method Details
#cache_key ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/active_record_caching/cache_serializing.rb', line 7 def cache_key if defined?(super) super elsif object.respond_to?(:cache_key) object.cache_key else raise NoMethodError, "undefined method `cache_key' for #{object}" end end |
#perform_caching? ⇒ Boolean
3 4 5 |
# File 'lib/active_record_caching/cache_serializing.rb', line 3 def perform_caching? valid_representation? && super end |
#respond_to?(method_name, *args) ⇒ Boolean
17 18 19 20 21 22 23 |
# File 'lib/active_record_caching/cache_serializing.rb', line 17 def respond_to?(method_name, *args) return super if method_name != :cache_key # If the serializer explicitly defines :cache_key or the object itself # defines it, then we can assume that :cache_key is supported method(:cache_key).owner != CacheSerializing || object.respond_to?(:cache_key) end |