Answers for "rails add column"

2

activerecord add column

class AddPartNumberToProducts < ActiveRecord::Migration[6.0]
  def change
    add_column :products, :part_number, :string
  end
end
Posted by: Guest on November-11-2020
0

rails add_column after

add_column :patient_allergies, :reaction_id, :integer, after: :patient_id
Posted by: Guest on July-07-2021
-1

rails model column

class AddColumnTitles < ActiveRecord::Migration
  def up
    add_column :titles, :place, :string
  end

  def down
    remove_column :titles, :place, :string
  end
end
Posted by: Guest on June-07-2020

Browse Popular Code Answers by Language