Hi, is there a way to use Paginators with other sources than active record models? Govinda Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle Freunde gleichzeitig schicken: freemail.web.de/features/?mc=021179 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
def paginate_collection(collection, options = {}) default_options = {:per_page => 10, :page => 1} options = default_options.merge options pages = Paginator.new self, collection.size, options[:per_page], options[:page] first = pages.current.offset last = [first + options[:per_page], collection.size].min slice = collection[first...last] return [pages, slice] end picked that up from somewhere... can''t remember where now... but that might help... Govinda Pfister wrote:> Hi, > > is there a way to use Paginators with other sources than active record > models? > > Govinda > > > > Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle > Freunde gleichzeitig schicken: > *freemail.web.de/features/?mc=021179* > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >lists.rubyonrails.org/mailman/listinfo/rails > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Hello Sean, thanks a lot for the code snippet. I think this is what I needed. Govinda rails-1W37MKcQCpLRv0WFA/ZhaQ@public.gmane.orgyonrails.org schrieb am 04.08.05 08:54:13: def paginate_collection(collection, options = {}) default_options = {:per_page => 10, :page => 1} options = default_options.merge options pages = Paginator.new self, collection.size, options[:per_page], options[:page] first = pages.current.offset last = [first + options[:per_page], collection.size].min slice = collection[first...last] return [pages, slice] end picked that up from somewhere... can''t remember where now... but that might help... Govinda Pfister wrote: > Hi, > > is there a way to use Paginators with other sources than active record > models? > > Govinda > > > > Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle > Freunde gleichzeitig schicken: > *freemail.web.de/features/?mc=021179* > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle Freunde gleichzeitig schicken: freemail.web.de/features/?mc=021179 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Please only post text to the mailing list. -- doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org