nesquena / rabl

General ruby templating with json, bson, xml, plist and msgpack support
http://blog.codepath.com/2011/06/27/building-a-platform-api-on-rails/
MIT License
3.64k stars 334 forks source link

How can you limit amount of child? #670

Open yukitoto opened 8 years ago

yukitoto commented 8 years ago

I want to limit child amount.

object false
child @chat_groups, root: :chat_groups, object_root: false do
  child :messages, root: :messages, object_root: false do
    attributes :id
  end
end
krzysiek1507 commented 8 years ago

@yukitoto could you explain?

yukitoto commented 8 years ago

ChatGroup has many Messages. I want to limit messages limit to 40. if use above snippet, all messages will send. But I don't know how to limit messages.

yukitoto commented 8 years ago

@krzysiek1507 Where you need more explanation?

ieglonew01f commented 5 years ago

@yukitoto

try this it worked for me. https://stackoverflow.com/questions/10871721/limit-amount-of-childs-in-rabl