• K
    Use `count(:all)` in HasManyAssociation#count_records · 4a7b4f88
    Klas Eskilson 提交于
    Problem: Calling `count` on an association can cause invalid SQL queries
    to be created where the `SELECT COUNT(a, b, c)` function receives
    multiple  columns. This will cause a `StatementInvalid` exception later
    on.
    
    Solution: Use `count(:all)`, which generates a `SELECT COUNT(*)...`
    query independently of the association.
    
    This also includes a test case that, before the fix, broke.
    4a7b4f88
has_many_associations_test.rb 81.8 KB