Skip to content

Backbone.Rel: Backbone lightweight model relationship manager

github.com/masylum
48 pointsmasylum4 comments
On HN

Comments

This looks neat! But obvious question, how does this compare to the Backbone-relational library? One useful feature in Backbone-relational is the includeInJSON option, which can be used to either include/ignore or select a single attribute from the related model to be included in the toJSON output of the parent model. Would you have to manually do that here?

That's what I was going to ask.

I am by no means an expert, but syntactically, I prefer how backbone-relational does things so that it looks and feels more like working with native Backbone objects, but I honestly don't know what's different about this otherwise.

Awesome. Does this simplify the whole retrieval and setting of relationship as they are loaded via the standard fetch mechanism?

A real pain point for us at with Backbone is transversing these relationships in JS. We end up doing redundant renders as related models finally come into memory.

It's a simple abstraction around filtering objects in a collection by an id. Your collection must be already fetched.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.