Forum: Ruby on Rails [HELP] pagination w habtm association and authorization plugin...

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.
Kad K. (Guest)
on 2009-05-31 20:47
(Received via mailing list)
I am using the proven authorization plugin to defines roles for users,
so I can get  all groups where a user is 'member'

@groups = current_user.group_memberships

I have an habtm association between groups and events

class Group < ActiveRecord::Base
 has_and_belongs_to_many :events
class Event < ActiveRecord::Base
  has_and_belongs_to_many :groups

I am trying to list and paginate (with the will_paginate plugin)   all
events in all groups a user belongs to...

I thought initially to build an array of ids from @groups and
paginate :
    @events = Event.paginate :page => params[:page],    :conditions =>
["group_id IN(?)",  group_ids]

but group_id is not a key in the events table....

any hint ?  thanks
This topic is locked and can not be replied to.