change column name Rails
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this table: 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 the 'season' column should be called 'season_id'. I know that I have to write 't.rename :season, :season_id' as explained in http://edgeguides.rubyonrails.org/active_record_migrations.html#column-modifiers but I don't manage to find the right syntax. Should it be? class CreateShoes < ActiveRecord::Migration def change create_table :shoes do |t| t.string