model with array rails
create_table :products do |t|
t.string :name
t.text :colors, array: true, default: []
end
model with array rails
create_table :products do |t|
t.string :name
t.text :colors, array: true, default: []
end
Ruby Array.new syntax
Array.new( number of indices, value of the indices ) { optional block for value of indices }
ary = Array.new #=> []
Array.new(3) #=> [nil, nil, nil]
Array.new(3, true) #=> [true, true, true]
Array.new(3) { Hash.new } #=> [ {}, {}, {} ]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us