ActiveRecordeのwhereメソッドでlikeを使う
Book.where('tag = ?', tag_b)
これを↓こうするとlikeが使えます。
Book.where('tag like ?', "%#{tag_b}%")
Book.where("tag like '%?%'", tag_b)
とか
Book.where('tag like ?', tag_b)
とかだと動きません。
直感的じゃないのでwhere以外で実現した方が良いかもしれません。
Book.where('tag = ?', tag_b)
これを↓こうするとlikeが使えます。
Book.where('tag like ?', "%#{tag_b}%")
Book.where("tag like '%?%'", tag_b)
とか
Book.where('tag like ?', tag_b)
とかだと動きません。
直感的じゃないのでwhere以外で実現した方が良いかもしれません。