If you have polymorphic belongs_to associations then references will add both of the columns required:
create_table :products do |t| t.references :attachment,
polymorphic means that it can belong to different objects (or, different records in different tables). The way it determines this is based on the type and id fields. If your association was not polymorphic it would only have an _id field.