Hey i have a many to many relationship between Users &
PrivmessageThreads. This is where users will have many threads of
privmsgs, and vice versa. I trying to do a query on a PrivmsgThread
to just find the other user_id’s in the thread.
something similar to :
select * from PrivmsgsThreads_Users WHERE privmsg_thread_id = 1 &&
user_id != (current_user_id)
im using has_and_belongs_to_many in both my users and privmsgthread
model, but dunno how to do a query like this.
Hey i have a many to many relationship between Users &
PrivmessageThreads. This is where users will have many threads of
privmsgs, and vice versa. I trying to do a query on a PrivmsgThread
to just find the other user_id’s in the thread.
something similar to :
select * from PrivmsgsThreads_Users WHERE privmsg_thread_id = 1 &&
user_id != (current_user_id)
Well you could do exactly that.
im using has_and_belongs_to_many in both my users and privmsgthread
model, but dunno how to do a query like this.
If you were using has_many :through, then you could just do
thread.thread_readers.user_ids (assuming thread_readers was your
through table)