mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Add support for embed: :ids option for in associations
This commit is contained in:
7
test/fixtures/poro.rb
vendored
7
test/fixtures/poro.rb
vendored
@@ -35,6 +35,7 @@ end
|
||||
|
||||
Post = Class.new(Model)
|
||||
Comment = Class.new(Model)
|
||||
Author = Class.new(Model)
|
||||
|
||||
PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :title, :body, :id
|
||||
@@ -47,3 +48,9 @@ CommentSerializer = Class.new(ActiveModel::Serializer) do
|
||||
|
||||
belongs_to :post
|
||||
end
|
||||
|
||||
AuthorSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id, :name
|
||||
|
||||
has_many :posts, embed: :ids
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user