A
A
Anton Misyagin2017-12-01 11:07:27
ORM
Anton Misyagin, 2017-12-01 11:07:27

How to select users with photos?

One-to-many relationship. One user can have 0 or more photos. How to make a Feng Shui request for all users who have photos (one or more). You can just query on SQL, you can immediately on Rails. Thanks
Similar tasks:
How to select users whose cart is not empty?
How to select users who have ever made payments?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Demidenko, 2017-12-01
@sunnmas

User.joins(:photos)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question