Added _getForeignKey() helper method
Code refactored
testAttachToMultiPrimaryKeyMistmatch() test removed
Set PK to 'id' if table has no connection.
Fixed belongsToMany tests associating with 'tag' instead of 'tags'