Erwin
2009-May-31 16:46 UTC
[HELP] pagination w habtm association and authorization plugin...
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