Specify ActiveRecord 3.1 version for determining foreign_key.

This will prevent fallback to deprecated primary_key_name method when using gem with ActiveRecord 4.x.