diff --git a/README.rdoc b/README.rdoc index e352a55..de41c2b 100644 --- a/README.rdoc +++ b/README.rdoc @@ -6,14 +6,14 @@ A Scope & Engine based, clean, powerful, customizable and sophisticated paginato == Features * Clean -Does not globally pollute Array, Hash, Object or AR::Base. +Does not globally pollute +Array+, +Hash+, +Object+ or AR::Base. * Easy to use Just bundle the gem, then your models are ready to be paginated. No configuration required. Don't have to define anything in your models or helpers. * Simple scope-based API Everything is method chainable with less "Hasheritis". You know, that's the Rails 3 way. -No special collection class or anything for the paginated values, instead using a general AR::Relation instance. So, of course you can chain any other conditions before or after the paginator scope. +No special collection class or anything for the paginated values, instead using a general AR::Relation instance. So, of course you can chain any other conditions before or after the paginator scope. * Customizable engine-based I18n-aware helper As the whole pagination helper is basically just a collection of links and non-links, Kaminari renders each of them through its own partial template inside the Engine. So, you can easily modify their behaviour, style or whatever by overriding partial templates. @@ -48,63 +48,63 @@ Then bundle: === Query Basics -* the :page scope -To fetch the 7th page of users (per_page = 25 by default) +* the +:page+ scope +To fetch the 7th page of users (default +per_page+ is 25) User.page(7) -* the :per scope -To show a lot more users per each page (change the per_page value) +* the +:per+ scope +To show a lot more users per each page (change the +per_page+ value) User.page(7).per(50) -Note that the :per scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use "per_page" without specifying the "page" number. +Note that the +:per+ scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use +per_page+ without specifying the +page+ number. -=== Configuring default per_page value for each model +=== Configuring default +per_page+ value for each model -* paginates_per -You can specify default per_page value per each model using the following declarative DSL. +* +paginates_per+ +You can specify default +per_page+ value per each model using the following declarative DSL. class User < ActiveRecord::Base paginates_per 50 end === Controllers -* the page parameter is in params[:page] +* the page parameter is in params[:page] Typically, your controller code will look like this: @users = User.order(:name).page params[:page] === Views * the same old helper method -Just call the "paginate" helper: +Just call the +paginate+ helper: <%= paginate @users %> -This will render several "?page=N" pagination links surrounded by an HTML5