Module | WillPaginate::ActiveRecord::BaseMethods |
In: |
lib/will_paginate/active_record.rb
|
Wraps find_by_sql by simply adding LIMIT and OFFSET to your SQL string based on the params otherwise used by paginating finds: page and per_page.
Example:
@developers = Developer.paginate_by_sql ['select * from developers where salary > ?', 80000], :page => params[:page], :per_page => 3
A query for counting rows will automatically be generated if you don‘t supply :total_entries. If you experience problems with this generated SQL, you might want to perform the count manually in your application.