byroot / activerecord-typedstore

ActiveRecord::Store but with type definition
MIT License
441 stars 57 forks source link

unable to make sql query with coder: JSON and psql #86

Open GuillaumeM59 opened 3 years ago

GuillaumeM59 commented 3 years ago

Hi, I tried to execute sql query with postgresql on my typed store column but nothing return. I'm looking to make scopes and sql queries using settings.

I have two users with 'foo' settings set to true. User.where('("settings"-->>\'foo\')::boolean IS TRUE').size #=> 0 instead 2

You can find exemple with rspec test here: https://github.com/GuillaumeM59/typed_store_sql_query

it's look like postgresql jsonb data is over stringified ...

thanks

borisrorsvort commented 12 months ago

@GuillaumeM59 Have you tried with the coder: ActiveRecord::TypedStore::IdentityCoder ?