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?

Flamine
  • 487
  • 4
  • 21
  • The dupe answers this but tl;dr: you should load extensions on the DB object, not on `Sequel`. There's some doc on what are global extensions and what are DB extensions. https://github.com/jeremyevans/sequel/blob/master/doc/extensions.rdoc – Joe Mar 04 '18 at 21:37

0 Answers0