Hello Jens, just a quick question about your code...

if i am using this:

 @test = 
County.find_by_contents(@params['search_string'],:first_doc=>0,:num_docs=>10)

do i just setup up numbered links in my view to pass a variable to 
first_doc? so if i wanted to get the next set, id do:


 @test = 
County.find_by_contents(@params['search_string'],:first_doc=>@params['10'], 
:num_docs=>10)


if this is the case, is there an easier way and also a way to count how 
many sets or how many pages there are in a table for a given query? 
would i just get a total from the array and then divide by 10 docs? 
etc...?


thanks!





Jens Kraemer wrote:
> Hi!
> 
> On Mon, May 01, 2006 at 08:55:22AM +0200, SchmakO wrote:
>> 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


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to