Skip to content

Instantly share code, notes, and snippets.

@zporter
Created October 26, 2010 17:18
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 zporter/647331 to your computer and use it in GitHub Desktop.
Save zporter/647331 to your computer and use it in GitHub Desktop.
Method used to determine if multiple pages are necessary
def if_multiple_pages?(collection, per_page = 10)
pages = (collection.size / (per_page || 10).to_f).ceil
yield pages if pages > 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment