Fix deprecation warning by calling #connection on object's class