I have has_and_belongs_to_many association between two models Chat and User.
I need to search for a chats by chat_members (user_ids).
for example:
Chat.where(users: User.last(3))
Is there an easy way to implement this task?
I have has_and_belongs_to_many association between two models Chat and User.
I need to search for a chats by chat_members (user_ids).
for example:
Chat.where(users: User.last(3))
Is there an easy way to implement this task?