spine / spine

Lightweight MVC library for building JavaScript applications

Home Page:http://spine.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hasOne and hasMany calls inconsistent

wschmrdrNS opened this issue · comments

In relation.coffee, the hasMany method is calling refresh, while hasOne is calling an update. Consider the following example:

class A extends Spine.Model
@hasmany 'b', 'model-link'
@hasone 'c', 'model-link'

When loading a model A object using JSON sent by a server to populate the object that includes data for A['b'] and A['c'], the update call within hasOne has the unintended effect of automatically trying to post A['c'], when the refresh behaviour seen when recognizing A['b'] is expected.