Class: CreatePreferences
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreatePreferences
- Defined in:
- lib/generators/preferences/templates/create_preferences.rb
Instance Method Summary collapse
Instance Method Details
#down ⇒ Object
13 14 15 |
# File 'lib/generators/preferences/templates/create_preferences.rb', line 13 def down drop_table :preferences end |
#up ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/generators/preferences/templates/create_preferences.rb', line 2 def up create_table :preferences do |t| t.string :name, null: false t.references :owner, polymorphic: true, null: false t.references :group, polymorphic: true t.string :value t. end add_index :preferences, [:owner_id, :owner_type, :name, :group_id, :group_type], unique: true, name: "index_preferences_on_owner_and_name_and_preference" end |