The can.Model.models arrayName should be configurable like observable's 'id' property #128

Closed
rajaravipati opened this Issue Oct 28, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@rajaravipati

http://donejs.com/docs.html#!can.Model.static.models

{
    count: 15000 //how many total items there might be
    data: [{id: 1, name : "justin"},{id:2, name: "brian"}, ...]
}

The 'data' array name is currently hardcoded in the source code. This could be a configurable property & is very easy to implement.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Oct 31, 2012

Contributor

Suggestions on what to call it? We should probably do the same thing for model instances.

can.Model({
  modelsAttr: 'recipes',
  modelAttr: 'recipe'
},{})
Contributor

justinbmeyer commented Oct 31, 2012

Suggestions on what to call it? We should probably do the same thing for model instances.

can.Model({
  modelsAttr: 'recipes',
  modelAttr: 'recipe'
},{})
@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Nov 27, 2012

Contributor

Could we just do it similar to the AJAX method converters (where it converts { findAll : "GET /todos" } into a findAll method) and have the string be the data attribute:

can.Model({
  models: 'recipes',
  model: 'recipe'
},{});

Will assign a models function that uses the "recipes" as the data attribute.

Contributor

daffl commented Nov 27, 2012

Could we just do it similar to the AJAX method converters (where it converts { findAll : "GET /todos" } into a findAll method) and have the string be the data attribute:

can.Model({
  models: 'recipes',
  model: 'recipe'
},{});

Will assign a models function that uses the "recipes" as the data attribute.

@ghost ghost assigned daffl Jan 8, 2013

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Mar 15, 2013

Contributor

I like that idea ...

Contributor

justinbmeyer commented Mar 15, 2013

I like that idea ...

@ghost ghost assigned justinbmeyer Sep 20, 2013

justinbmeyer added a commit that referenced this issue Sep 22, 2013

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Sep 22, 2013

Contributor

It still needs to be documented.

Contributor

justinbmeyer commented Sep 22, 2013

It still needs to be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment