ruby on rails - How to get records from one table which are not in another table's fields (3) -
i want records table binaryfile
binaryfile.id
not in image.fullimage_id
and not in image.preview_id
and not in image.thumbnail_id
i tried following, records binaryfile
not in image.fullimage_id
or not in image.preview_id
or not in image.thumbnail_id
binaryfiles = binaryfile.where('id not in (?)', [image.select("fullimage_id"), image.select("preview_id"), image.select("thumbnail_id")])
how can change condition or
and
?
binaryfile.where.not(id: image.pluck(:fullimage_id, :preview_id, :thumbnail_id).flatten)
Comments
Post a Comment