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 :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
...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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---