Můžete použít Foreigner drahokam.
Potom změňte migraci na toto:
class CreateBookCheckOuts < ActiveRecord::Migration
def self.up
create_table :book_check_outs do |t|
t.integer :book_id, :null => false
t.integer :person_id, :null => false
t.datetime :OutDate, :null => false
t.datetime :ReturnDate, :null => true
t.timestamps
end
add_foreign_key(:book_check_outs, :books)
add_foreign_key(:book_check_outs, :people)
end
def self.down
remove_foreign_key(:book_check_outs, :books)
remove_foreign_key(:book_check_outs, :people)
drop_table :book_check_outs
end
end