我有这张桌子:
class CreateShoes < ActiveRecord::Migration
def change
create_table :shoes do |t|
t.string :name
t.boolean :leather
t.integer :season
t.timestamps null: false
end
end
end
"Season"列应该称为"Season_id".我知道我必须像在http://edgeguides.rubyonrails.org/active_record_migrations.html#column-modifiers中解释的那样编写‘.rename:season,:season_id’,但是我找不到正确的语法.应该是吗?
class CreateShoes < ActiveRecord::Migration
def change
create_table :shoes do |t|
t.string :name
t.boolean :leather
t.integer :season
t.timestamps null: false
end
change_table :products do |t|
t.rename :season, :season_id
end
end
end
不管用.我需要在Mac控制台中做什么吗?谢谢!