Hi,

I am trying to do pagination on the parent of a model association, yet show 
all the associated children for each "page" of parents.

Ideally I would like to use a library like will_paginate or kaminari to 
save myself some effort creating the rendered, paged views.

I have the following models in a Rails app:

class Recipient < Sequel::Model
  one_to_many :devicesend
class Device < Sequel::Model
  many_to_one :recipientsend

i.e. Each Recipient has one or more Devices

To paginate on Recipient but show all Devices for each page of recipients 
respectively, in SQL something like this works:

SELECT 
  paged_recipients.first_name, paged_recipients.last_name, devices.*FROM
  (
    SELECT first_name, last_name 
    FROM recipients ORDER by id OFFSET 10 LIMIT 10
  ) paged_recipientsINNER JOIN
  devices ON paged_recipients.id = devices.recipient_idORDER BY
  paged_recipients.id

Any idea if this can this be done in Sequel, ideally using the pagination 
extension?

Any help would be hugely appreciated.

Thanks,

Steve

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to