1

I use ruby, pg and sequel. I cat write array to db, but can not take it back. This is code example:

require "sequel"
require "pg"
Sequel.extension :pg_array, :core_extensions
DB = Sequel.connect("postgres://postgres@localhost/postgres")
DB.create_table? :items do
  primary_key :id
  column :positions, "integer[]"
end
items = DB[:items]
items.insert(positions:  Sequel.pg_array([1, 2, 3]))
items.all.last[:positions] # <---- it is string. Not array

Can anybody help me with it?

1

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.