acts_as_paginable

Motivation

Use and chain scoped_by methods in conjunction with will_paginate to create a filterable and paginable record list.

Requirements

  • Ruby on Rails
  • will_paginate

Usage

acts_as_paginable(:scopes => [ :attribute1, :attribute2 ])
params = { "bills_id" => "10", "customer_id" => "3", :page => "4"}
MyModel.atq_paginate(params, 10)

Results in

MyModel.scoped_by_bills_id("10").scoped_by_customer_id("3").paginate(:page => "4", :per_page => "10")