Skip to content

Commit

Permalink
Remove element from IngredientSerializer
Browse files Browse the repository at this point in the history
This association causes infinite recursion during
deserialization, because the element is already
included in the page's elements association's data.
  • Loading branch information
tvdeyen committed Aug 23, 2024
1 parent 64fb6f7 commit e8065a3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
2 changes: 0 additions & 2 deletions lib/alchemy/json_api/ingredient_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module Alchemy
module JsonApi
module IngredientSerializer
def self.included(klass)
klass.has_one :element, record_type: :element, serializer: ::Alchemy::JsonApi::ElementSerializer

klass.attributes(
:role,
:value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,4 @@
end
end
end

describe "relationships" do
subject { serializer.serializable_hash[:data][:relationships] }

it "has one element" do
expect(subject[:element]).to eq(data: {id: ingredient.element_id.to_s, type: :element})
end
end
end

0 comments on commit e8065a3

Please sign in to comment.