Use foreign_key for ActiveRecord 4.0.0

The previous fix didn't work for 4.0.0, since it always checked the minor version.
Merge pull request #21 from lucas-clemente/patch-1

Use foreign_key for ActiveRecord 4.0.0