Hi!

I was wondering if there is more elegent way to filter using values stored 
in hstore column.

I have an Entry model (Sequel::Model) that I want to filter basing on 
values in :status column (of :hstore type).

My flags are: :processed, :duplicate, :eol.

I found out that query:
Entry.where("status -> 'processed' = 'true'")
produces
SELECT * FROM \"entries\" WHERE (status -> 'flag_processed' = 'true')
and works as expected, but just doesn't feel right to pass in a string as 
an argument.

Using:
Entry.where(status: Sequel.hstore(processed: true))
produces:
SELECT * FROM \"entries\" WHERE (\"status\" = 
'\"processed\"=>\"true\"'::hstore)
and although does not return error, doesn't return any values either.

I'm using Sequel 4.14.0, Ruby 2.1.2, PostgreSQL 9.3.2.

Thanks!
Lucas


-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to