Forum: Ruby on Rails Pagination with habtm

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Josh (Guest)
on 2006-05-15 19:14

I am building a discussion board-like application in which messages are
associated with one or more workgroups via has_and_belongs_to_many.  I
would like to be able to display to my users a distinct list of messages
for the workgroup(s) that they are part of in paginated form.  The SQL
for this query would be something like the following:

select distinct (, m.title, m.created_at from messages m,
messages_workgroups mw, workgroups w where = mw.message_id and
= mw.workgroup_id and in (1,2,3)

How can I do something like this using the pagination functionality?  I
feel as if I might be missing something simple here.

This topic is locked and can not be replied to.