Class: IbhamCreateVotes
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- IbhamCreateVotes
- Defined in:
- lib/generators/ibham/templates/migration.rb
Instance Method Summary collapse
Instance Method Details
#change ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/generators/ibham/templates/migration.rb', line 2 def change create_table :votes do |t| t.references :voter, polymorphic: true t.references :voteable, polymorphic: true t.integer :value t. null: false end add_index :votes, [:voter_id, :voter_type] add_index :votes, [:voteable_id, :voteable_type] end |