I have the folowing migration but don't know what to use in the down
method
change_table :addresses do |t|
t.references :addressable, :polymorphic => true
end
actually,
change_table :addresses do |t|
t.remove_references :addressable
end
would be a bit railsier, no?
edit: As Eben Geer points out
change_table :addresses do |t|
t.remove_references :addressable, :polymorphic => true
end
is the correct way to do this. Cheers!
class RemoveAddressableFromAddresses < ActiveRecord::Migration
def change
remove_reference :addresses, :addressable, polymorphic: true, index: true
end
end
def self.down
change_table :addresses do |t|
t.remove_references :addressable, :polymorphic => true
end
end
What's the problem?
def self.down
remove_column :addresses, :addressable_type
remove_column :addresses, :addressable_id
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With