mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Add key option to serializer associations
This commit is contained in:
8
test/fixtures/poro.rb
vendored
8
test/fixtures/poro.rb
vendored
@@ -228,6 +228,14 @@ PostWithTagsSerializer = Class.new(ActiveModel::Serializer) do
|
||||
has_many :tags
|
||||
end
|
||||
|
||||
PostWithCustomKeysSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id
|
||||
|
||||
has_many :comments, key: :reviews
|
||||
belongs_to :author, key: :writer
|
||||
has_one :blog, key: :site
|
||||
end
|
||||
|
||||
VirtualValueSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user