jupiterjs / jquerymx

jQuery MVC Extensions. jQuery extensions that makes all the annoying stuff easier.
http://javascriptmvc.com
553 stars 374 forks source link

jquery/model/associations plugin is broken #3

Closed tdreyno closed 14 years ago

tdreyno commented 14 years ago

Looks like this plugin was either never finished, or left behind during the 3.0 updates. Its test cases fail and are not included in the main jquery/test/qunit.js list of tests.

I'm not entirely sure I need the functionality yet, but either this plugin should be updated or removed before 3.0.

jupiterjs commented 14 years ago

Associations are supposed to work like: init : function(){ this.hasMany("CN.Models.Loan","loans"); this.hasMany("CN.Models.Issue","issues"); this.hasMany("CN.Models.Note","notes"); this.belongsTo("CN.Models.Person","person") }

The idea is if you got data like:

[ { loans : [{ ... }], issues: [{ ... }], notes: [{ ... }], person : { ... }, }, ... ]

The models would create instances of CN.Models.Loan so you could access them like:

customer.loans()[0].destroy();

jupiterjs commented 14 years ago

This was used on our first 3.0 app. I haven't gotten to cleaning up model yet, but I will take a look at this, probably this week.

tdreyno commented 14 years ago

Oh, yeah, I'm doing this manually in my load data callback with wrapMany. Would be nice to use this plugin instead.

jupiterjs commented 14 years ago

Plugin should be working. Reopen if I am wrong.