How to query array column from mysql in Rails 5.2?

前端 未结 2 1131
被撕碎了的回忆
被撕碎了的回忆 2021-01-27 23:47

I am using gem rails~> 5.2 and gem mysql2 >= 0.3.13, < 0.5.

I have a model Lawer, which has an array column lawer_f

2条回答
  •  失恋的感觉
    2021-01-28 00:13

    I didn't try this answer because I don't have any Rails project ready for testing, but I think the problem is in the syntax.

    I think it should be something like this:

    Lawer.where("lawer_field IN (?)", "2")

提交回复
热议问题