Created
December 10, 2012 12:58
-
-
Save sur/4250400 to your computer and use it in GitHub Desktop.
Pagination for Parse Resource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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