Answers for "rails rename model and table"

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

Code answers related to "rails rename model and table"

Browse Popular Code Answers by Language