configures acts_as_votable [#9]

This commit is contained in:
rgarcia
2015-07-18 18:09:48 +02:00
parent 3ee102c0c5
commit b8e41551f9
4 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
class ActsAsVotableMigration < ActiveRecord::Migration
def self.up
create_table :votes do |t|
t.references :votable, :polymorphic => true
t.references :voter, :polymorphic => true
t.boolean :vote_flag
t.string :vote_scope
t.integer :vote_weight
t.timestamps
end
add_index :votes, [:voter_id, :voter_type, :vote_scope]
add_index :votes, [:votable_id, :votable_type, :vote_scope]
end
def self.down
drop_table :votes
end
end