Fix for Rails 4 and invalid gemspec.

Defaults to the deprecated `primary_key_name` method instead of the `foreign_key` method when the `ActiveRecord::VERSION::MINOR >= 1` because it fails to check the major version.