Join GitHub today
Changing AR:CollectionAssociation#empty? to use #exists? #7270
COUNT(*) queries can be slow in PostgreSQL, #exists? avoids this by selecting a single record. @jonleighton suggested in issue #3179 that #empty? should be patched to use #exists? for the same benefit. I couldn't think of a great way to test it since the external behavior is not changing. If anyone has any suggestions for tests though, I would be more than happy to add them.
added a commit
this pull request
Aug 5, 2012