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.
Merge pull request #2 from johtso/patch-1

Check for existence of relations property