Answers for "rails database array"

1

model with array rails

create_table :products do |t|
  t.string :name
  t.text :colors, array: true, default: []
end
Posted by: Guest on July-01-2020
0

rails store array in database

class AddSubjectsToBook < ActiveRecord::Migration
  def change
    add_column :books, :subjects, :text, array:true, default: []
  end
end
Posted by: Guest on January-28-2021

Browse Popular Code Answers by Language