Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rajaravipati opened this issue Oct 28, 2012 · 4 comments
Assignees
Milestone

Comments

@rajaravipati
Copy link

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
Copy link
Contributor

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

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

@daffl
Copy link
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
Copy link
Contributor

I like that idea ...

@ghost ghost assigned justinbmeyer Sep 20, 2013
justinbmeyer added a commit that referenced this issue Sep 22, 2013
@justinbmeyer
Copy link
Contributor

It still needs to be documented.

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

No branches or pull requests

3 participants