0

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?

Dmitry
  • 6,716
  • 14
  • 37
  • 39
QNester
  • 463
  • 4
  • 9
  • Are you asking how to [store arrays in Postgres](https://stackoverflow.com/questions/21312278/storing-arrays-in-database-json-vs-serialized-array)? Or are you not familiar with `has_many`? – Mark Thomas Sep 30 '17 at 20:29

1 Answers1

1

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)
QNester
  • 463
  • 4
  • 9