So I have
render json: Post.all
This returns all my Posts and in my Post serializer I have
class PostSerializer < ActiveModel::Serializer
has_many :comments
end
I want the number of comments returned in the JSON to be limited to 5 and have a variable which tells if more comments are there. Is this possible?
Edit: I think I'll manage the more part with a new call. But can't figure out how to limit the comments in the serializer