Hotfix habtm foreign keys

**Issue**
When using a HABTM relationship with non-standard foreign keys, the behaviour would generate sql which would fail, because the foreignKey would be assumed.

**Fix**
I've changed the code to read the keys from the habtm relationship.

**Other bits**
I've also tidied up the test class a little, removing all the random tabs, and changing the old underscored methods to use a proper skip method. I've also added a new test which tests the new functionality.