activerecord-postgres-hstore
activerecord-postgres-hstore copied to clipboard
How does one use bound variables when searching for keys?
Given your example Person.where("data ? 'foo'")
, how would one rewrite that to use a bound variable? Person.where("data \? ?")
results in ActiveRecord::PreparedStatementInvalid: wrong number of bind variables (1 for 2)
.
Instead of using ? use key/value pairs.
Person.where("date ? :key", :key => 'foo')