Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Show only suppliers with articles in the dropdown-menu for new orders #347
Plain SQL would also be an option:
Using group by and having:
Supplier.joins(:articles).group(:supplier_id).having('COUNT(articles.id) > 0').last
Both materialize to one query. The first was faster for me.