Answer the question
In order to leave comments, you need to log in
How to query on two fields in rails?
How to correctly write a query to select from a table by two fields, if the id matches in the sender_id column or in the recipient_id column, then take them together?
@recipients = Company.joins(:invitations).where(invitations: {sender_id: @company.id OR recipient_id: @company.id ,confirm: true})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question