我的红宝石代码:
Portfolio.where("data @> (:key => :value)", :key => 'CSJ', :value => '0.1')
生成以下 SQL:
"SELECT \"portfolios\".* FROM \"portfolios\" WHERE (data @> ('CSJ' => '0.1'))"
出现此错误:
Error: PG::Error: ERROR: operator does not exist: unknown => unknown
LINE 1: ...olios".* FROM "portfolios" WHERE (data @> ('CSJ' => '0.1'))
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT "portfolios".* FROM "portfolios" WHERE (data @> ('CSJ' => '0.1'))
Postgresql 9.1.4,Rails 3.2.7/8,在我的模型代码中使用带有以下内容的 activerecord-postgres-hstore gem:
serialize :data, ActiveRecord::Coders::Hstore
帮助将不胜感激!