Answer the question
In order to leave comments, you need to log in
How to do the reverse side of joins?
Friends, help! The task is simple along the way, but I can not finish it. and I can't find it in the documentation.
There is, for example, such a thing: expired_order=Order.joins(:order_expired)
If the application has expired, then a new OrderExperied is added to the database, which has a belongs_to to the Order model.
That is, this code will display all orders that have an attached OrderExperied.
but I need the opposite to display all tasks that do NOT have an attached OrderExperied.
To be something like this: expired_order=Order.joins.not(:order_expired)
How to implement this correctly?
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