Sha256: 04d9ec4b4afb5594135b1dce4332188452581db0a97246d087584325e68b6e77
Contents?: true
Size: 704 Bytes
Versions: 50
Compression:
Stored size: 704 Bytes
Contents
class ThumbsUpMigration < ActiveRecord::Migration def self.up create_table :votes, :force => true do |t| t.boolean :vote, :default => false t.references :voteable, :polymorphic => true, :null => false t.references :voter, :polymorphic => true t.timestamps end add_index :votes, [:voter_id, :voter_type] add_index :votes, [:voteable_id, :voteable_type] # Comment out the line below to allow multiple votes per voter on a single entity. add_index :votes, [:voter_id, :voter_type, :voteable_id, :voteable_type], :unique => true, :name => 'fk_one_vote_per_user_per_entity' end def self.down drop_table :votes end end
Version data entries
50 entries across 50 versions & 1 rubygems