Skip to content

Uncaught TypeError: Object [object Object] has no method 'validate'  #33

@sydekumf

Description

@sydekumf

Unfortunately I couldn't create a working example with your tutorial because Ember.Object.extend does not work, is it outdated?

So I have the following:

App.User = DS.Model.extend(Ember.Validations, {
    validations: {
        firstname: {
            presence: true
        }
   }
}

My Controller which handles the user object which is created by user input (form elements):

App.IndexController = Ember.Controller.extend({
    actions: {
        register: function(){
            var user = this.get('model');
            user.validate();
       }
    }
});

At that moment I get the error: Uncaught TypeError: Object [object Object] has no method 'validate'
What have I done wrong? Bug? Thx for help.

For your information, why Ember.Object.extend does not work, I get the following error then:

Assertion failed: Expected hash or Mixin instance, got [object Undefined] ember.js:394
DEPRECATION: Action handlers contained in an `events` object are deprecated in favor of putting them in an `actions` object (error on <App.ApplicationRoute:ember230>)
        at Object.triggerEvent (http://localhost:9000/bower_components/ember/ember.js:30519:13)
        at trigger (http://localhost:9000/bower_components/ember/ember.js:29641:16)
        at handleError (http://localhost:9000/bower_components/ember/ember.js:29903:9)
        at invokeCallback (http://localhost:9000/bower_components/ember/ember.js:8055:19)
        at null.<anonymous> (http://localhost:9000/bower_components/ember/ember.js:8109:11)
        at EventTarget.trigger (http://localhost:9000/bower_components/ember/ember.js:7878:22)
        at http://localhost:9000/bower_components/ember/ember.js:8180:17
        at Object.DeferredActionQueues.flush (http://localhost:9000/bower_components/ember/ember.js:5459:24)
        at Object.Backburner.end (http://localhost:9000/bower_components/ember/ember.js:5545:27) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions