我发现这里的答案无益:Rails 3 Add Foreign Key in Migration Problems
实现邮箱gem的namedspaced分支我遇到以下问题:
add_foreign_key "mailboxer_receipts", "mailboxer_notifications", :name => "receipts_on_notification_id"
#Messages
add_foreign_key "mailboxer_notifications", "mailboxer_conversations", :name => "notifications_on_conversation_id"
add_foreign_key :pairs, :programmers,
:source_column => :second_id,
:name => :fk_second_programmer
这里的文档对我没有帮助: http://araddconstraint.rubyforge.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html
最后一个外键似乎是从上面的文档链接(???)复制的。错误抱怨外键的名称无关紧要 - 这让我觉得这是一个语法错误。