Ruby on rails 如何正确实现jsonb阵列的where?
我添加了要在其中存储ID的jsonb字段 接下来,我需要根据该字段的内容对记录进行“搜索” 在任何地方,包括文档(),我都看到了这个操作符-Ruby on rails 如何正确实现jsonb阵列的where?,ruby-on-rails,activerecord,ruby-on-rails-5,ruby-on-rails-6,Ruby On Rails,Activerecord,Ruby On Rails 5,Ruby On Rails 6,我添加了要在其中存储ID的jsonb字段 接下来,我需要根据该字段的内容对记录进行“搜索” 在任何地方,包括文档(),我都看到了这个操作符-@>。但我没有成功地使用它: User.where.not(“迁移\u id@>?”,1) 请告诉我,怎么做才对?这应该行得通 User.where.not(“迁移”\u id@>?,“1”) ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR: operator does not e
@>
。但我没有成功地使用它:
User.where.not(“迁移\u id@>?”,1)
请告诉我,怎么做才对?这应该行得通
User.where.not(“迁移”\u id@>?,“1”)
ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR: operator does not exist: jsonb @> integer)
LINE 1: ...s".* FROM "users" WHERE NOT (migration_ids @> 1) LIMI...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.