Productsテーブルがあり、列を追加したい:
t.references :imageable, :polymorphic => true
私はこれを行うことで移行を生成しようとしていました:
$ rails generate migration AddImageableToProducts imageable:references:polymorphic
しかし、私は明らかにそれを間違っています。誰か提案できますか?ありがとう
移行を生成した後に手動で挿入しようとすると、次のようになりました。
class AddImageableToProducts < ActiveRecord::Migration
def self.up
add_column :products, :imageable, :references, :polymorphic => true
end
def self.down
remove_column :products, :imageable
end
end
そしてそれはまだ機能していません