Answers for "in a migration how do you change a column name rails?"

1

How can I rename a database column in a Ruby on Rails migration?

rails generate migration rename_title_to_name_in_tasks

class RenameTitleToNameInTasks < ActiveRecord::Migration[6.0]
  def change
    rename_column :tasks, :title, :name
  end
end
Posted by: Guest on December-10-2021

Code answers related to "in a migration how do you change a column name rails?"

Browse Popular Code Answers by Language