Change #primary_key_name to #foreign_key (Rails 3.1+)