dhruvaray / backbone-associations

Create object hierarchies with Backbone models; Respond to hierarchy changes using regular Backbone events.
http://dhruvaray.github.io/backbone-associations/
MIT License
492 stars 75 forks source link

Fetch with remove:false #122

Closed chiplay closed 10 years ago

chiplay commented 10 years ago

I have a model that I'm fetching and it has a 1-to-M collection of "Products" and a 1-to-M collection of "Refinements" which are models with their own 1-to-M collection of "Products". If I run the fetch with { remove: false } set (typically a collection fetch flag) - it honors it for the first level collection relationship, but not the nested relationship - it adds duplicate products to that collection. Is this something that can be worked around? Thanks!

chiplay commented 10 years ago

hold the presses - fixed by changing my polymorphic relatedModel to a collectionType function - which I'm assuming better handles the idAttribute parsing in Backbone. Cheers!

dhruvaray commented 10 years ago

@chiplay : Thanks! You saved me some debugging effort! Generally speaking, it helps to send over some code (failing test) with the issue. So it's easy for me to quickly debug thru. Otherwise, I need to write out the boiler plate code... A small request for future issues (hopefully less :))

chiplay commented 10 years ago

@dhruvaray can do!