I'm trying to hide activities where their owners have deleted their accounts. So I added this
PublicActivity::Activity.order("created_at DESC").where( recipient: current_user).where.not(owner: nil)
but it returns
undefined method `image' for nil:NilClass
meaning it's adding activities with deleted users to the record. How can I hide them?