added fix and tests for defining the foreign_key
merged master
Merge pull request #8 from sportngin/foreign_key

Foreign key