mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Fix infinite recursion
The method for testing whether to include an association was causing an infinite loop when two models referenced each other.
This commit is contained in:
8
test/fixtures/poro.rb
vendored
8
test/fixtures/poro.rb
vendored
@@ -38,6 +38,7 @@ end
|
||||
Post = Class.new(Model)
|
||||
Comment = Class.new(Model)
|
||||
Author = Class.new(Model)
|
||||
Bio = Class.new(Model)
|
||||
Blog = Class.new(Model)
|
||||
|
||||
PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
@@ -59,6 +60,13 @@ AuthorSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id, :name
|
||||
|
||||
has_many :posts, embed: :ids
|
||||
belongs_to :bio
|
||||
end
|
||||
|
||||
BioSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id, :content
|
||||
|
||||
belongs_to :author
|
||||
end
|
||||
|
||||
BlogSerializer = Class.new(ActiveModel::Serializer) do
|
||||
|
||||
Reference in New Issue
Block a user