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?

1
  • Are you asking how to store arrays in Postgres? Or are you not familiar with has_many? Commented Sep 30, 2017 at 20:29

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.