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

Dev warning when can.Model is extended without static properties. #716

Closed
justinbmeyer opened this issue Feb 5, 2014 · 2 comments
Closed

Comments

@justinbmeyer
Copy link
Contributor

When can.Model is extended without static properties like:

Todo = can.Model.extend({
  findAll: "GET /todos"
});

This is almost always a mistake. We should warn users with something like:

can/model/model.js: can.Model extended without static properties.

VOTE FOR THIS FEATURE HERE: http://bithub.com/event/25835

@daffl daffl added this to the 2.1.2 milestone May 28, 2014
daffl added a commit that referenced this issue Jun 3, 2014
#716 can.Model now warns the developer when no static properties are specified
@daffl
Copy link
Contributor

daffl commented Jun 6, 2014

Closed via #1016

@daffl daffl closed this as completed Jun 6, 2014
@daliborfilus
Copy link

This helped me discover something unusual. If you do this in canjs 2.2.5:

steal('can/model', 'can/map/attributes', function() {
can.Model.extend('HiThere',
// @Static
{
  attributes: {},
  findAll: function() {
    // doesn't matter
  }
},
// @Prototype
{}
)
})

It will throw this error and the model is empty, without definitions. Incomplete. Dead.
But I'm giving it the name, static props and prototype props.

The cause of this is the stealing of can/map/attributes, which breaks it completely and causes it to break. It is deprecated, but it's removed from docs but not from canjs package, so I didn't even knew it was deprecated :-DThis helped me discover something unusual. If you do this in canjs 2.2.5:

steal('can/model', 'can/map/attributes', function() {
can.Model.extend('HiThere',
// @Static
{
  attributes: {},
  findAll: function() {
    // doesn't matter
  }
},
// @Prototype
{}
)
})

It will throw this error and the model is empty, without definitions. Incomplete. Dead.
But I'm giving it the name, static props and prototype props.

The cause of this is the stealing of can/map/attributes, which breaks it completely and causes it to break. It is deprecated, but it's removed from docs but not from canjs package, so I didn't even knew it was deprecated :-D

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

4 participants