Class: CreateRates
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateRates
- Defined in:
- lib/generators/letsrate/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
16 17 18 |
# File 'lib/generators/letsrate/templates/migration.rb', line 16 def self.down drop_table :rates end |
.up ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/letsrate/templates/migration.rb', line 3 def self.up create_table :rates do |t| t.belongs_to :rater t.belongs_to :rateable, :polymorphic => true t.float :stars, :null => false t.string :dimension t. end add_index :rates, :rater_id add_index :rates, [:rateable_id, :rateable_type] end |