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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -