If you have polymorphic belongs_to associations then references will add both of the columns required:
create_table :products do |t|
t.references :attachment,
Basically, polymorphic association by definition adds ability to create associations with many other Rails ActiveRecord Models.
Both Columns are there for Rails to know which Model the association is referring to, you have the attachment_type column (ie String) (default value is "Photo",table-name: photos in the db), and the attachment_id is sort of like a foreign key to that particular Model/table (ie Photo).
Usually this provides you flexibility to associate one Model to many others.