Rails 3 advanced queries

In one of my queries I used

......- .includes(:classes).where(:classes => { items_classes => { :item_class_id => nil } }) to find unclassified items i.e., items with 'item_class_id IS NULL' from the join table. How could I modify the query for classified items i.e., if I want something like '!= nil' in place of '=>nil' ? I had tried installing gems sqeel, meta_where, but they show combatibility issues with my rails version 3.2.5.

Thanks, Rashila.