AssociationCollection.count Can Return Incorrect Value

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

There are more details on the problem and the implementation of the
patch in the lighthouse ticket:


- Patrick Joyce