Module: ActiveModelSerializers::Model::Caching
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_model_serializers/model/caching.rb
Instance Method Summary collapse
-
#cache_key ⇒ Object
Defaults to the downcased model name and updated_at.
-
#updated_at ⇒ Object
Defaults to the time the serializer file was modified.
Instance Method Details
#cache_key ⇒ Object
Defaults to the downcased model name and updated_at
13 14 15 16 17 18 |
# File 'lib/active_model_serializers/model/caching.rb', line 13 def cache_key ActiveSupport::Cache.([ self.class.model_name.name.downcase, "#{id}-#{updated_at.strftime('%Y%m%d%H%M%S%9N')}" ].compact) end |
#updated_at ⇒ Object
Defaults to the time the serializer file was modified.
21 22 23 |
# File 'lib/active_model_serializers/model/caching.rb', line 21 def updated_at defined?(@updated_at) ? @updated_at : File.mtime(__FILE__) end |