Separated scope chaining from invokation of paginate. This allows you to invoke further methods on the chained scope such as:
Bill.chain_scopes(params, per_page).sum("billing_positions.amount")
So
Bill.atq_paginate(params, per_page).paginate
is now defined as:
chain_scopes(:page => params[:page], :per_page => per_page).paginate(:page => params[:page], :per_page => per_page)
- Now supports params[:order] passed to the corresponding named_scope
- named_scope “order” to be able to order records like this:
MyClass.scoped_by_attr.order("id DESC")