Paging with multiple tables/models

I’m looking for a smooth way to implement paging over a combination of
two tables.

My application tracks which books and movies you have borrowed from
me. For reasons that make sense elsewhere in the application, these
are seperated out into two tables: book_borrowers and movie_borrowers
and therefore 2 different activerec objects: BookBorrower and
MovieBorrower

This particular screen will display something like this (plz excuse
formatting):

Name Has Borrowed


Ron Book1, Book2, Movie4
Bob Book3
Tom Movie1

Paging seems quite simple if I would like to display either books or
movies that you have borrowed in a table but I’m struggling a bit in
paging over the combination.

I’ve played with having a seperate object that combines the two (and
is paginated), having one of my two objects select and join/union, but
neither seems completely bug free and clean.

Any ideas?

Thanks.

  • Jim

If it helps…
movie_borrower columns: id, user_id, movie_id
book_borrower columns: id, user_id, book_id

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs