mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 23:06:50 +00:00
Change hardcoded class in favor of using provided serializer class in AR integration tests
This commit is contained in:
parent
ef1ec65ae7
commit
021efae95b
@ -58,17 +58,17 @@ module ActiveModel
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def embed(klass, options = {})
|
def embed(serializer_class, options = {})
|
||||||
old_assocs = Hash[ARPostSerializer._associations.to_a.map { |(name, association)| [name, association.dup] }]
|
old_assocs = Hash[serializer_class._associations.to_a.map { |(name, association)| [name, association.dup] }]
|
||||||
|
|
||||||
ARPostSerializer._associations.each_value do |association|
|
serializer_class._associations.each_value do |association|
|
||||||
association.embed = options[:embed]
|
association.embed = options[:embed]
|
||||||
association.embed_in_root = options[:embed_in_root]
|
association.embed_in_root = options[:embed_in_root]
|
||||||
end
|
end
|
||||||
|
|
||||||
yield
|
yield
|
||||||
ensure
|
ensure
|
||||||
ARPostSerializer._associations = old_assocs
|
serializer_class._associations = old_assocs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user