SQL 2 table(or model) query

Hi, you can do the following to query for the events associated with a
particular user:

class User < ActiveRecord::Base
  has_and_belongs_to_many :events
end

class Event < ActiveRecord::Base
  has_and_belongs_to_many :users
end

Now, you can do the following to determine what events are associated
with a given user:

user.events

Now, you can do the following to determine what users are associated
with a given event:

event.users

Lastly, I would recommend reading chapter 18 of AWDwRv2 for further information:

Good luck,

-Conrad

Hi Mike, your join table should be named:

events_users

-Conrad