A little confused but I'm guessing you're trying to create a many-to-many relationship between Users and Events (i.e. a User has many Events and an Event has many Users).
If so you DO NOT want to do it by storing all the user_ids in the Event model and vice versa. What you want to to is create a join table that holds the ids for each
#database table
create_table "user_events", force: :cascade do |t|
t.integer "user_id"
t.integer "event_id"
t.datetime "created_at"
t.datetime "updated_at"
end
#join table
class UserEvents < ActiveRecord::Base
belongs_to :user
belongs_to :event
end
#user
class User < ActiveRecored::Base
has_many :user_events, dependent: :destroy
has_many :events, through: :user_events
end
#event
class Event < ActiveRecord::Base
has_many :user_events, dependent: :destroy
has_many :users, through: :user_events
end
with this structure you are telling your application that Users and Events are related through UserEvents and will have access to all sorts of useful keyword.
For example you could do
Event.includes(:users).all.map {|event| event.user.first.id}
which will return all the id of the first user from every event, which is what I think you're trying to accomplish.
eventstable?