sdepold/sequelize — pull request #356 by guersam (2012-12-03 17:02:34+00:00)
Title: fix #334 ('include' places a "null" element to the result if no data is related)

First draft of the fix.

I decided to check the emptiness after building a DAO instance to get identifiers upon existing methods, but it brings unnecessary nested loops.

The second option is to determine identifier name from DAOFactory with hasPrimeryKey and primaryKeys fields out of the loop. It's better for performance but results in tight coupling. We might need to modify DAOFactory to provide identifier info by itself.

Which solution do u guys prefer?

p.s. Test cases about associations are growing bigger and bigger. Is it okay or is some creation helper needed?