Class: ActsAsVotableMigration
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- ActsAsVotableMigration
- Defined in:
- lib/generators/acts_as_votable/migration/templates/active_record/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
17 18 19 |
# File 'lib/generators/acts_as_votable/migration/templates/active_record/migration.rb', line 17 def self.down drop_table :votes end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/acts_as_votable/migration/templates/active_record/migration.rb', line 2 def self.up create_table :votes do |t| t.references :votable, :polymorphic => true t.references :voter, :polymorphic => true t.boolean :vote_flag t. end add_index :votes, [:votable_id, :votable_type] add_index :votes, [:voter_id, :voter_type] end |