Home Rails - ActiveUUID Returning UUID as Binary String with Postgres
Reply: 0

Rails - ActiveUUID Returning UUID as Binary String with Postgres

Saim
1#
Saim Published in 2017-12-31 07:08:52Z

We have a Rails 4.2 application with MySQL. We are in the middle of migrating it to Postgres. We are also using ActiveUUID gem with our Rails application.

When I try to run the application with Postgres, I am getting the invalid byte sequence in UTF-8 errors. When I inspect the ID in rails console it as a binary string instead of a UUID. It looks something like this:

irb(main):003:0> id
"\x00\x00)\xC3$\fI\v\x9D\x02\xE2\xE4\xA9\xFF\x99\xCD"

irb(main):003:0> UUIDTools::UUID.parse_string(id)
=> #<UUID:0x3fd685ef6140 UUID:000029c3-240c-490b-9d02-e2e4a9ff99cd>

How can make it (pg gem) to automatically convert ids (binary string) to UUID, like it used to be working mysql2 gem.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.348824 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO