Query for records where a column is not nil in Rails 4 Order.where(email: @hotelUser.email).where.not(hotel_user_id: nil)