module ActiveModelSerializers::Model::Caching

Public Instance Methods

cache_key() click to toggle source

Defaults to the downcased model name and updated_at

# File lib/active_model_serializers/model/caching.rb, line 12
def cache_key
  ActiveSupport::Cache.expand_cache_key([
    self.class.model_name.name.downcase,
    "#{id}-#{updated_at.strftime('%Y%m%d%H%M%S%9N')}"
  ].compact)
end
updated_at() click to toggle source

Defaults to the time the serializer file was modified.

# File lib/active_model_serializers/model/caching.rb, line 20
def updated_at
  defined?(@updated_at) ? @updated_at : File.mtime(__FILE__)
end