Backbone-relational icon indicating copy to clipboard operation
Backbone-relational copied to clipboard

collection.model is replaced

Open ghost opened this issue 11 years ago • 3 comments

Our application uses clever Backbone.Collection.model() because we store in collection different types of models. We have "dynamic" relatedModel.

I made a (mini copy) demo of our application to demonstrate how it works and where is the problem.

Here it is

Here it uses my fixed version of Backbone-relational

The idea is that Backbone-relational should not replace Collection.model if it's something custom wrote by user. This means that user knows that it should return and instance of relatedModel but he wants to do there some clever logic. Backbone-relational should allow him to have a custom Collection.model.

ghost avatar Jun 10 '14 18:06 ghost

:+1: While my use case could be solved by having a custom relatedModel call in the association, this works as well and looks cleaner.

lunks avatar Jul 07 '14 10:07 lunks

We are using the fixed version in this project

ghost avatar Oct 22 '14 13:10 ghost

Sound useful for some cases. Could you maybe make a pull request out of this, and add a small test to demonstrate how to use this feature?

PaulUithol avatar Oct 24 '14 10:10 PaulUithol