Mathieu Chappuis
2005-Dec-08 15:20 UTC
Accessing paginate extras attributes or methods for parsing collection of records ?
Dears, I paginate records using a medium complex query with :conditions : like id in (select ....) and id in (select ..) Because that query is very high cost in time and ressources I''aint to add additionnals queries for counting or else. Once one record is displayed, how access the next id in the paginated collection, w/o querying again just for next id ? Like : id name 45 bob 47 bill 98 rob 78 david In displaying rob''s record (/show/98) i''ll like to have Next and Previous record. Thanks , -- Mathieu _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Lou Vanek
2005-Dec-08 15:28 UTC
Re: Accessing paginate extras attributes or methods for parsing collection of records ?
In your paginate query pull down 1 more record than you display just so you know its "Next" ID. Mathieu Chappuis wrote:> Dears, > > I paginate records using a medium complex query with :conditions : > > like id in (select ....) and id in (select ..) > > Because that query is very high cost in time and ressources I''aint to > add additionnals queries for counting or else. > > Once one record is displayed, how access the next id in the paginated > collection, w/o querying again just for next id ? > > Like : > > id name > 45 bob > 47 bill > 98 rob > 78 david > > In displaying rob''s record (/show/98) i''ll like to have Next and > Previous record. > > Thanks , > > -- > Mathieu