Created
March 30, 2016 22:53
-
-
Save alexgriff/5d7c0db6fc1f03efab1fb3a3e38371cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MakeVoterPolymorphic < ActiveRecord::Migration | |
def change | |
add_column :voters, :voterable_id, :integer | |
add_column :voters, :voterable_type, :string | |
end | |
end | |
# you could also use a shortened syntax that would do the same thing | |
# and add these two columns to the table | |
class MakeVoterPolymorphic < ActiveRecord::Migration | |
def change | |
change_table :voters do |t| | |
t.references :voterable, :polymorphic => true | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment