openstreetmap-website

https://github.com/openstreetmap/openstreetmap-website

Ruby

The Rails application that powers OpenStreetMap

ActionController::Pagination#paginate

Returns a paginator and a collection of Active Record model instances
for the paginator's current page. This is designed to be used in a
single action; to automatically paginate multiple actions, consider
ClassMethods#paginate.

+options+ are:
<tt>:singular_name</tt>:: the singular name to use, if it can't be inferred by singularizing the collection name
<tt>:class_name</tt>:: the class name to use, if it can't be inferred by
                       camelizing the singular name
<tt>:per_page</tt>::   the maximum number of items to include in a
                       single page. Defaults to 10
<tt>:conditions</tt>:: optional conditions passed to Model.find(:all, *params) and
                       Model.count
<tt>:order</tt>::      optional order parameter passed to Model.find(:all, *params)
<tt>:order_by</tt>::   (deprecated, used :order) optional order parameter passed to Model.find(:all, *params)
<tt>:joins</tt>::      optional joins parameter passed to Model.find(:all, *params)
                       and Model.count
<tt>:join</tt>::       (deprecated, used :joins or :include) optional join parameter passed to Model.find(:all, *params)
                       and Model.count
<tt>:include</tt>::    optional eager loading parameter passed to Model.find(:all, *params)
                       and Model.count
<tt>:select</tt>::     :select parameter passed to Model.find(:all, *params)

<tt>:count</tt>::      parameter passed as :select option to Model.count(*params)

<tt>:group</tt>::     :group parameter passed to Model.find(:all, *params). It forces the use of DISTINCT instead of plain COUNT to come up with the total number of records

Source | Google | Stack overflow

Edit

git clone [email protected]:openstreetmap/openstreetmap-website.git

cd openstreetmap-website

open lib/classic_pagination/pagination.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-ActionController--Pagination-paginate-for-pr


# Commit to git

git add lib/classic_pagination/pagination.rbgit commit -m "better docs for ActionController::Pagination#paginate"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-ActionController--Pagination-paginate-for-pr

hub pull-request


# Celebrate!