Sequel and Postgres array of enum

507 views Asked by At

I have enum_cars.

I have table user with column: own_cars: enum_cars[]

When I get User model and fetch own_cars field for instance, I have:

user.own_cars #=> "{Ford}" String

I connected

DB.extension :pg_array

and

Sequel.extension :pg_array

But this doesn't work for me. What I should do to fetch field as Array? Or it's impossible with enum array?

1

There are 1 answers

0
QNester On BEST ANSWER

Resolve this problem.

If you have in table array enum field u should registrate array type:

DB.extension :pg_array
DB.register_array_type(:enum_cars)