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

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

Comments

Projects
None yet
4 participants
@justinbmeyer
Contributor

justinbmeyer commented Feb 5, 2014

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

@justinbmeyer justinbmeyer added the Feature label Feb 5, 2014

@shcarrico shcarrico added the Dev Build label Apr 15, 2014

@daffl daffl added this to the 2.1.2 milestone May 28, 2014

daffl added a commit that referenced this issue Jun 3, 2014

Merge pull request #1016 from bitovi/716-no-static-prop-warning
#716 can.Model now warns the developer when no static properties are specified
@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Jun 6, 2014

Contributor

Closed via #1016

Contributor

daffl commented Jun 6, 2014

Closed via #1016

@daffl daffl closed this Jun 6, 2014

@NoICE

This comment has been minimized.

Show comment
Hide comment
@NoICE

NoICE May 10, 2015

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

NoICE commented May 10, 2015

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