Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: f185e5070c
Fetching contributors…

Cannot retrieve contributors at this time

16 lines (13 sloc) 0.379 kB
class ChangeVotesToPolymorphic < ActiveRecord::Migration
def self.up
rename_column :votes, :post_id, :voteable_id
add_column :votes, :voteable_type, :string
Vote.all.each do |vote|
vote.update_attribute(:voteable_type, 'Post')
end
end
def self.down
remove_column :votes, :voteable_type
rename_column :votes, :voteable_id, :post_id
end
end
Jump to Line
Something went wrong with that request. Please try again.