Check for existence of relations property

If we don't do this, and `.relations` is not defined, then `_.has`
will throw a `"Cannot convert undefined or null to object"` exception.