arraysrubypostgresqlenumssequel-gem

Sequel and Postgres array of enum


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?


Solution

  • 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)