Hi!

On Mon, May 01, 2006 at 08:55:22AM +0200, SchmakO wrote:
> I'm just wondering where I would put the pagination for search results 
> when using "acts_as_ferret".
> 
> At the moment my search code is..
> 
> def search
>     @query = params[:query] || ''
>     unless @query.blank?
>       @results = Tutorial.find_by_contents @query
>     end
> end

find_by_contents has two options suitable for paging:
:first_doc (first result to retrieve) and
:num_docs (number of results to retrieve).

so to retrieve results 10 to 20, you would use
@results = Tutorial.find_by_contents(@query,:first_doc=>10,:num_docs=>10)

hth,
Jens


-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to