Hi,

I'm having problems when using the pg_json extension with models that
load the table name using Seguel.delay.

DB.extension :pg_json

This works as expected:

class Foo < Sequel::Model(DB.from(:foo))
end

Foo.new(json_column: { a: 1 }).json_column.class
=> Sequel::Postgres::JSONBHash

But this doesn't:

class Foo < Sequel::Model(DB.from(Sequel.delay{:foo}))
end

Foo.new(json_column: { a: 1 }).json_column.class
=> Hash

I expect the json_column to be a JSONBHash, as the first case, but I get a
Hash instead.

I'm using Sequel.delay because I'm qualifying the table dynamically, as
discussed here:
https://groups.google.com/g/sequel-talk/c/88x5BKr61p4/m/2lVsF2U5tgsJ

I was taking a look at the pg_json extension code but couldn't find what
could be the cause. Not sure either if this is related to extensions in
general or not.

Any insight would be appreciated.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CALXCfb1WgXGnRyD8yxfXX2eNsbnFsM%3DXfWms%2BHmZEaB%2BLK1x2g%40mail.gmail.com.

Reply via email to