palkan/pgrel

Add model name to query

Closed this issue · 0 comments

Hello, @palkan !

I have several models with "data" columns in jsonb. When I try to generate complex query with joins or includes, I receive "ambiguous" sql error.

I suggest to add model name to query, to specify what column sql should be used.

Example:

Event.where.store(:data, additional_projects: true)

SQL:

SELECT "events".* FROM "events" WHERE "events"."deleted_at" IS NULL AND (events.data @> '{"additional_projects":true}')