I was hoping to find some reviewers for my patch.
AssociationCollection.count can return an incorrect value if a finder_sql is a multiline string and there is a new line character immediately following "SELECT". I ran into this when I was writing a long :finder_sql query for a has_many association and I wanted to split the query on to multiple lines for readability purposes. This issue affects HasManyAssociations, HasAndBelongToManyAssociations, and HasManyThroughAssociations.
There are more details on the problem and the implementation of the patch in the lighthouse ticket: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2118-associationcollectioncount-returns-incorrect-value
Thanks!
- Patrick Joyce