mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Merge pull request #902 from cristianbica/serializer_file_digest
Added serializer file digest to the cache_key
This commit is contained in:
@@ -19,6 +19,7 @@ module ActiveModel
|
||||
attr_accessor :_cache_only
|
||||
attr_accessor :_cache_except
|
||||
attr_accessor :_cache_options
|
||||
attr_accessor :_cache_digest
|
||||
end
|
||||
|
||||
def self.inherited(base)
|
||||
@@ -26,6 +27,8 @@ module ActiveModel
|
||||
base._attributes_keys = self._attributes_keys.try(:dup) || {}
|
||||
base._associations = self._associations.try(:dup) || {}
|
||||
base._urls = []
|
||||
serializer_file = File.open(caller.first[/^[^:]+/])
|
||||
base._cache_digest = Digest::MD5.hexdigest(serializer_file.read)
|
||||
end
|
||||
|
||||
def self.attributes(*attrs)
|
||||
|
||||
Reference in New Issue
Block a user