Out of the box, you technically have to write some SQL statements (where) ...
gallery_to_exclude = Gallery.first
Collection.find(:all,
:include => :presentations,
:conditions => ['presentations.gallery_id IS NULL OR presentations.gallery_id != ?',
gallery_to_exclude.id])
If you want to use Searchlogic , you can avoid this:
Collection.presentations_gallery_id_is_not(gallery_to_exclude.id).all
source
share