Active Record Update All JSON Field
问题 So I have a model Item that has a huge postgresql JSON field called properties . Most of the time this field does not need to be queried on or changed, however we store price in this field. I'm currently writing a script that updates this price , but there's only a few unique prices and thousands of Items so in order to save time I have a list of Items for each unique price and I'm attempting to do an update all: Item.where(id: items).update_all("properties->>'price' = #{unique_price}") But