mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
clear the cache between requests
This commit is contained in:
parent
3fb560908e
commit
2b0c5ee084
@ -199,12 +199,12 @@ module ActiveModel
|
||||
opts
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.serializers_cache
|
||||
@serializers_cache ||= Threadsafe::Cache.new
|
||||
@serializers_cache ||= ThreadSafe::Cache.new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.get_serializer_for(klass)
|
||||
serializers_cache.fetch_or_store(klass) do
|
||||
serializer_class_name = "#{klass.name}Serializer"
|
||||
|
||||
@ -9,6 +9,9 @@ begin
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
include ::ActionController::Serialization
|
||||
ActionDispatch::Reloader.to_prepare do
|
||||
ActiveModel::Serializer.serializers_cache.clear
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
# rails not installed, continuing
|
||||
|
||||
Loading…
Reference in New Issue
Block a user