I have the following migration
class LinkDoctorsAndSpecializations < ActiveRecord::Migration def up add_reference :doctors, :doctor_specialization, poly
As I commented, do :
add_index :table, :column, name: 'index name'
Here is documentation. Or, you can try this :
class LinkDoctorsAndSpecializations < ActiveRecord::Migration def change add_reference :doctors, :doctor_specialization, polymorphic: true, index: { name: 'index name' } end end