Forum: Ruby on Rails Help....Paginating_find

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D8f444b5c1b0304a2b98d5b16da0f2f1?d=identicon&s=25 Jeba Momin (zeba)
on 2009-01-23 08:43
Hi everyone,
I'm using the paginating_find plugin to give pagination to my views...
It works great....but
Even if there is a single page in the list....it gives me a pagination
link....which I don't want...!!!
I need some help to know- how to check whether there is a only one page
in the result...so that I don't print the links....
Thank You....
85f8b7bbe07bff22e0b38cca818cf692?d=identicon&s=25 Luke Pearce (kule)
on 2009-01-23 16:58
Use ruby script/console in a command prompt to try things out...

>> c = Company.find(:all, :page => {:current => 1, :size => 1}, :limit => 1)
=> #<PagingEnumerator:0x5d29880 @page_count=1, @first_page=1, @size=1,
@page=1, @page_size
=1, @callback=#<Proc:0x0618463c@C:/../lib/paginating_find.rb:82>,
@last_page=1, @stop_page=1, @auto=false>

>> c.page_count
=> 1

In your view check that @your_collection.page_count > 1 before you call
the paginating find partial that generates the pages.
D8f444b5c1b0304a2b98d5b16da0f2f1?d=identicon&s=25 Jeba Momin (zeba)
on 2009-01-27 06:53
Hey Luke...
Thank you so much for your help....
That solution worked like a charm....
Thanks again...


Luke Pearce wrote:
> Use ruby script/console in a command prompt to try things out...
>
>>> c = Company.find(:all, :page => {:current => 1, :size => 1}, :limit => 1)
> => #<PagingEnumerator:0x5d29880 @page_count=1, @first_page=1, @size=1,
> @page=1, @page_size
> =1, @callback=#<Proc:0x0618463c@C:/../lib/paginating_find.rb:82>,
> @last_page=1, @stop_page=1, @auto=false>
>
>>> c.page_count
> => 1
>
> In your view check that @your_collection.page_count > 1 before you call
> the paginating find partial that generates the pages.
This topic is locked and can not be replied to.