Merge pull request #792 from rails-api/association-overrides

Association overrides
This commit is contained in:
Guillermo Iguaran
2015-01-30 09:01:49 -05:00
16 changed files with 107 additions and 13 deletions

View File

@@ -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