Answers for "rails change column"

3

how to I change the name of a column in rails

$ rails g migration rename_season_to_season_id

class RenameSeasonToSeasonId < ActiveRecord::Migration
  def change
    rename_column :shoes, :season, :season_id
  end
end
Posted by: Guest on February-14-2020
2

edit column table ruby on rails

change_column :table, :column_name, :type, :whatever_here
Posted by: Guest on January-18-2021

Browse Popular Code Answers by Language