mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #792 from rails-api/association-overrides
Association overrides
This commit is contained in:
5
test/fixtures/poro.rb
vendored
5
test/fixtures/poro.rb
vendored
@@ -58,8 +58,13 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :title, :body, :id
|
||||
|
||||
has_many :comments
|
||||
belongs_to :blog
|
||||
belongs_to :author
|
||||
url :comments
|
||||
|
||||
def blog
|
||||
Blog.new(id: 999, name: "Custom blog")
|
||||
end
|
||||
end
|
||||
|
||||
SpammyPostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
|
||||
Reference in New Issue
Block a user