Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created June 14, 2012 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agibralter/2933494 to your computer and use it in GitHub Desktop.
Save agibralter/2933494 to your computer and use it in GitHub Desktop.
rabl pagination without object roots?
# @object is a paginated array of questions
collection @object, root: 'collection', object_root: false
attributes :question_text, :created_at, :updated_at
#=> {"collection": [{"question_text": "foo bar", "created_at": "...", "updated_at": "..."}, {...}, {...}]}
# I want this:
#=> {"collection": [{"question_text": "foo bar", "created_at": "...", "updated_at": "..."}, {...}, {...}], "page": 1, "total_pages": 10}
# glue? node? wtf?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment