Can you teach me how to set an attribute to Array in Model?.
I have tried it but when I use array's method like push, each, I got the error undefined method `push' for nil:NilClass
My migrate look like this:
class CreateContacts < ActiveRecord::Migration
def change
create_table :contacts do |t|
t.string :name
t.string :email
t.string :email_confirmation
t.integer :city_ids, array: true
t.text :description
t.timestamps
end
end
end
I would like to set attribute city_ids to Array.