In my 'new Post.List({})' call I want my JSON response to have extra attributes including the 'posts' array of collections. So I would like to have:
- {
- title: 'This is the title for topic',
- created_at: '30 mins ago',
- posts: [{
- id: 1,
- title: 'post 1',
- body: 'message blah blah'
- },{
- id: 2,
- title: 'post 2',
- body: 'message blah blah'
- }]
- }
I have read somewhere in the documentation about 'attributes' for models but I can't find it again. Below is my model, at the moment its very basic. By doing this how would I refer to the posts array from the view via this new JSON response?
- can.Model.extend 'Post',
- findAll: 'GET /api/v1/posts'
- create: 'POST /api/v1/posts'
- , {}
- Post.List = Post.List.extend()