add count to relations

Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
Handle toObject in updateAttributes

Since one can call updateAttributes with any kind of properties (as
opposed to save, which uses toObject internally), any objects that
correspond to toObject should be handled as such. This is particularly
the case with List objects, as used by embedsMany.
Merge pull request #221 from fabien/fix/updateAttributes

Handle toObject in updateAttributes
Merge pull request #205 from fabien/feature/plugins

Cleanup mixin tests
Merge pull request #213 from fabien/feature/scope-rel-methods

Implement scope.defineMethod/relation.defineMethod
Merge pull request #214 from fabien/fix/scope-order

Allow runtime override of scope/relation order query param
Merge pull request #211 from fabien/fix/relationTypes

Fix relationTypes
Clarified tests, fixed BelongsTo.prototype.create

Added clarified test-case based on previous documentation example.

Fixed BelongsTo.prototype.create - although the foreignKey was set on
the model instance,
it was never actually persisted, unless you'd issue a separate call to
save the 'parent' model.
Refactor polymorphic relations, fix inverse #215

See #215 - when creating a related item through a the inverse of a
polymorphic HABTM relation,
the through-model was not created correctly. By refactoring the
specifics into the `polymorphic`
property of a RelationDefinition, it's now possible to handle this
correctly.
Merge pull request #212 from offlinehacker/relations_count

add count to relations
Refactor embedsMany - auto-save parent

With this change, saving an embedded model now correctly updates the
parent model.

Before, a separate `save()` call on the parent was required, contrary
to other relation types.
Implement embedded.destroy() integration
Merge branch 'fix/relation-tests' of https://github.com/fabien/loopback-datasource-juggler into fix/relation-tests
Merge pull request #219 from fabien/fix/relation-tests

Fix  BelongsTo.prototype.create + remaining issues with new relation types
Fixed duplicate code
Merge pull request #222 from fabien/fix/relation-tests

Fixed duplicate code
Allow partial list of ids for sortByIds
Remove redundant test
Moved DataAccessObject.sortByIds to utils.js
Fix conflicts