Skip to content

Instantly share code, notes, and snippets.

@sur
Created December 10, 2012 12:58
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 sur/4250400 to your computer and use it in GitHub Desktop.
Save sur/4250400 to your computer and use it in GitHub Desktop.
Pagination for Parse Resource
example action and view code:
def index
page = params[:page].to_i.zero? ? 1 : params[:page].to_i
kids = current_day_care.kids(page)
@kids = kids[:kids]
unless kids[:total].to_i.zero?
@kids_pages = (1..kids[:total]).to_a.paginate(:page => page, :per_page => Kid::PerPage)
end
end
view code:
= page_links @kids_pages
or
= will_paginate @kids_pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment