aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-21 14:35:36 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-21 14:35:36 +0000
commit34a9ed5e85bad51b85ba1553221fbe7e8af6efc4 (patch)
tree65f0baa02db61fcd4d874f6e5ae5b08ec51c08a2 /actionpack/lib
parent24142e18666f98e058e163c5e349f5360b826497 (diff)
downloadrails-34a9ed5e85bad51b85ba1553221fbe7e8af6efc4.tar.gz
rails-34a9ed5e85bad51b85ba1553221fbe7e8af6efc4.tar.bz2
rails-34a9ed5e85bad51b85ba1553221fbe7e8af6efc4.zip
Tweaked the documentation
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@967 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/pagination.rb8
-rw-r--r--actionpack/lib/action_view/helpers/pagination_helper.rb10
2 files changed, 13 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/pagination.rb b/actionpack/lib/action_controller/pagination.rb
index 54324975e0..b9fa01df9f 100644
--- a/actionpack/lib/action_controller/pagination.rb
+++ b/actionpack/lib/action_controller/pagination.rb
@@ -11,13 +11,14 @@ module ActionController
# controller, have it automatically query your model for pagination; or,
# if you prefer, create Paginator objects yourself.
#
+ # Pagination is included automatically for all controllers.
+ #
# For help rendering pagination links, see
# ActionView::Helpers::PaginationHelper.
#
# ==== Automatic pagination for every action in a controller
#
- # class PersonController < ApplicationController
- # helper :pagination
+ # class PersonController < ApplicationController
# model :person
#
# paginate :people, :order_by => 'last_name, first_name',
@@ -110,8 +111,7 @@ module ActionController
paginator_and_collection_for(collection_id, options)
end
- # These methods become class methods on any controller which includes
- # PaginationHelper.
+ # These methods become class methods on any controller
module ClassMethods
# Creates a +before_filter+ which automatically paginates an Active
# Record model for all actions in a controller (or certain actions if
diff --git a/actionpack/lib/action_view/helpers/pagination_helper.rb b/actionpack/lib/action_view/helpers/pagination_helper.rb
index cb3c3807eb..f34359583b 100644
--- a/actionpack/lib/action_view/helpers/pagination_helper.rb
+++ b/actionpack/lib/action_view/helpers/pagination_helper.rb
@@ -1,6 +1,14 @@
module ActionView
module Helpers
# Provides methods for linking to ActionController::Pagination objects.
+ #
+ # You can also build your links manually, like in this example:
+ #
+ # <%= link_to "Previous page", { :page => paginator.current.previous } if paginator.current.previous %>
+ #
+ # <%= link_to "Next page", { :page => paginator.current.next } of paginator.current.next =%>
+ #
+ #
module PaginationHelper
unless const_defined?(:DEFAULT_OPTIONS)
DEFAULT_OPTIONS = {
@@ -25,7 +33,7 @@ module ActionView
# <tt>:link_to_current_page</tt>:: whether or not the current page
# should be linked to (defaults to
# +false+)
- # <tt>:pararms</tt>:: any additional routing parameters
+ # <tt>:params</tt>:: any additional routing parameters
# for page URLs
def pagination_links(paginator, options={})
options.merge!(DEFAULT_OPTIONS) {|key, old, new| old}