Given the following models with one-to-many relationship:
class App.Post extends Batman.Model
@hasMany 'comments'
class App.Comment extends Batman.Model
@belongsTo 'post'
My comments are included in the JSON of the post from the backend. Since i'm having @encode 'comments'
the comments are added to the post. However, they are added in an array of simple JS objects instead of an associationset of Batman objects.
Should I really decode them explicitly like this
@encode 'comments',
decode: (value, key, incomingJSON, outgoingAttributes, record) ->
outgoingAttributes = App.Comment.createMultipleFromJSON(incomingJSON.comments)
or am I doing something stupid here?