Slide 17
Slide 17 text
class PostSerializer < ActiveModel::Serializer
attributes :title, :body
has_many :comments
end
class CommentSerializer < ActiveModel::Serializer
attributes :name, :body
belongs_to :post
end
class PostPreviewSerializer < ActiveModel::Serializer
attributes :title, :preview
end