I have a model 2 that has a HABTM ratio
User
has_and_belongs_to_many :rooms
Room
has_and_belongs_to_many :users
I also create a transition to join a table like this
create_join_table :users, :rooms do |t|
t.index [:user_id, :room_id]
t.index [:room_id, :user_id]
end
I would like to request a room in which user_id of user B is among the rooms of user A. How can I do this?
source
share