Which page an object is from

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 :slight_smile:

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))

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?

…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?

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