sqlite - rails: How to find entries with empty arrays -
i've got issue finding empty arrays in sqlite table. i serialized product_category param, works saving arrays db, follows: serialize :product_category, array the following query find empty arrays param, giving me nil error: product.where(product_category: []).first how find products product_category has no values in array? i tried using {} instead of [] suggested in similar postgress related question. does know right way? i have tried on mysql, works me, please try. #product.rb serialize :product_category, array #rails console >> product = product.new >> product.product_category = [] >> product.save >> product.where("product_categoty = '[]'") #it returns last record have created. hope help!