Class: CreateFlags
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateFlags
- Defined in:
- lib/generators/flags/templates/create_flags.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
16 17 18 |
# File 'lib/generators/flags/templates/create_flags.rb', line 16 def self.down drop_table :flags end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/flags/templates/create_flags.rb', line 2 def self.up create_table :flags do |t| t.text :comment t.references :flaggable, :polymorphic => true t.references :user # other roles could be spam, inappropriate, etc. t.string :role, :default => "abuse" t. end add_index :flags, [:flaggable_type, :flaggable_id] add_index :flags, :user_id end |