Sha256: 996ea7f1abe944ab7a9ab77ca412d153c7f579e08c67cb05df0e2fc9a5d9e8c6
Contents?: true
Size: 758 Bytes
Versions: 11
Compression:
Stored size: 758 Bytes
Contents
class ThumbsUpMigration < ActiveRecord::Migration def self.up create_table :votes, :force => true do |t| t.boolean :vote, :default => false, :null => 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] <% if options[:unique_voting] == true %> # 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 %> end def self.down drop_table :votes end end
Version data entries
11 entries across 11 versions & 1 rubygems