flatiron/resourceful — Issue #15: Relationship type expected ['string',null] actual 'object' 
Author: slaskis
Created: 2011-11-15 14:08:20+00:00
State: open

When defining a relationship like this:

```
this.Article = resourceful.define('article', function () {
this.property('name', String);
});

this.Category = resourceful.define('category', function () {
this.property('name', String);
this.parent('article')
});
```

it fails with a validation error when a Category is created alone a it has no linked Article (i.e. the article_id is null).

After some debugging i figured out that it was either of these problems:

1. The relationships parent type is by default defined as: `[String,null]` where `typeof null` will be translated to 'object' which in turn makes it fail. Solution would be to change the type to `['string','null']` or `[String,'null']`.

2. Revalidator (will post a issue/pull request there too) expects the types to be strings but does not enforce it so [this section](https://github.com/flatiron/revalidator/blob/master/lib/revalidator.js#L306-317) will always be ignored unless it's a string.