# Which page an object is from

**URL:** <https://www.ruby-forum.com/t/which-page-an-object-is-from/81330>\
**Category:** Rails\
**Created:** [January 7, 2007, 9:17pm UTC](https://www.ruby-forum.com/t/which-page-an-object-is-from/81330 "2007-01-07T21:17:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![extempore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/6bbea6/32.png) [@extempore](https://www.ruby-forum.com/u/extempore)\
**Post date:** [January 7, 2007, 9:17pm UTC](https://www.ruby-forum.com/t/which-page-an-object-is-from/81330/1 "2007-01-07T21:17:41Z")

</div>

Hi all,  
is it possible to figure out which page a particular object belongs to?  
Say i have a paginated list of 10 image objects over 5 pages, and I have  
a list of thumbnails along the bottom of all 10 objects. the id’s of  
these aren’t in order, so i can’t figure it out that way. can i query my  
@object\_pages somehow to figure it out?

i hope that’s clear enough - i don’t understand this very well 🙂

---

<div class="post-metadata">

**Author:** ![extempore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/6bbea6/32.png) [@extempore](https://www.ruby-forum.com/u/extempore)\
**Post date:** [January 8, 2007, 10:42am UTC](https://www.ruby-forum.com/t/which-page-an-object-is-from/81330/2 "2007-01-08T10:42:39Z")

</div>

Paul PH wrote:

> Hi all,  
> is it possible to figure out which page a particular object belongs to?  
> Say i have a paginated list of 10 image objects over 5 pages, and I have  
> a list of thumbnails along the bottom of all 10 objects. the id’s of  
> these aren’t in order, so i can’t figure it out that way. can i query my  
> @object\_pages somehow to figure it out?

((from [api.rubyonrails.com](http://api.rubyonrails.com)))

find\_collection\_for\_pagination(model, options, paginator)

…kinda the oppisite of what you need (it checks what objects belong to  
a @object\_page) but is this of any help?

---

<div class="post-metadata">

**Author:** ![extempore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/6bbea6/32.png) [@extempore](https://www.ruby-forum.com/u/extempore)\
**Post date:** [January 8, 2007, 10:46am UTC](https://www.ruby-forum.com/t/which-page-an-object-is-from/81330/3 "2007-01-08T10:46:50Z")

</div>

…you can also use the order option on the paginator, so it will order  
it by your own means (you could order the 10 images by their id if it  
makes your life easier)

def …

paginate :objects, blah blah …  
:conditions =\> …  
:order =\> ‘whateverattributeyouwant asc’ # this is what you want?  
…

end

helping?

---

<div class="post-metadata">

**Author:** ![extempore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/6bbea6/32.png) [@extempore](https://www.ruby-forum.com/u/extempore)\
**Post date:** [January 8, 2007, 11:05am UTC](https://www.ruby-forum.com/t/which-page-an-object-is-from/81330/4 "2007-01-08T11:05:58Z")

</div>

harper wrote:

> …you can also use the order option on the paginator, so it will order  
> it by your own means (you could order the 10 images by their id if it  
> makes your life easier)
> 
> def …
> 
> paginate :objects, blah blah …  
> :conditions =\> …  
> :order =\> ‘whateverattributeyouwant asc’ # this is what you want?  
> …
> 
> end
> 
> helping?

thanks for the replies - i’ll try these out later.

cheers,  
Fox
