I'm using postgres 9.6.1, Rails 4.2.0, and the following migration:
class CreateStageBatches < ActiveRecord::Migration
def change
create_table :stage_batches do |t|
t.text :item_ids, array: true, default: []
end
end
end
How do I create an array of integers? I've tried:
[9] pry(main)> StageBatch.new item_ids: [1,2,3]
=> #<StageBatch id: nil, item_ids: ["1", "2", "3"]>
But they are strings.
Looking at the postgres docs it looks like this is possible but I'm not sure what the syntax is for my migration or instantiation.