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

Uncaught TypeError: Object function (){e.apply(this,arguments)} has no method 'walkPath' #70

Open
justinmakaila opened this issue Nov 14, 2012 · 0 comments

Comments

@justinmakaila
Copy link

If i create a NestedModel within my models.js, anytime I attempt to update the model through code, I receive the above error. My model is instantiated like so:

var Special = Backbone.NestedModel.extend({
    initialize : function () {
        // Log the changed properties
        this.on('change', function (model, options) {
            for ( var i in options.changes)
                this.display();
            updateSession(model);
        });
        // Update session var
        this.updateSession(this);
    },
    //Attributes
    defaults : function () {
        return {
            "Product" : null,
            "ShortDescription" : null,
            "Category" : "food",
            "Price" : {
                "Regular" : null,
                "Special" : null,
                "PercentOff" : null
            },
            "Date" : {
                "StartTime" : null,
                "EndTime" : null,
                "HumanTimeRange" : null
            },
            "Uses" : 0,
            "Tags" : [],
            "Contributor" : null
        }
    },

    //Functions
    display : function (property) {
        console.log(property + ': ' + this.get(property));
    },
    displayAll : function () {
        console.log('Product: ' + this.get('Product'));
        console.log('ShortDescription: ' + this.get('ShortDescription'));
        console.log('Category: ' + this.get('Category'));
        console.log('Price: {');
        console.log('  Regular: ' + this.get('Price.Regular'));
        console.log('  Special: ' + this.get('Price.Special'));
        console.log('  PercentOff: ' + this.get('Price.PercentOff') + '\n}');
        console.log('Date: {');
        console.log('  StartTime: ' + this.get('Date.StartTime'));
        console.log('  EndTime: ' + this.get('Date.EndTime'));
        console.log('  HumanTimeRange: ' + this.get('Date.HumanTimeRange') + '\n}');
        console.log('Uses: ' + this.get('Uses'));
        console.log('Tags: ' + this.get('Tags'));
        console.log('Contributor: ' + this.get('Contributor'));
    },
    updateSession : function (model) {
        Session.set('NewSpecial', model);
    }
});

// Empty special to hold user entered data pertaining to new special creation
NewSpecial = new Special();

If i attempt to modify the contents with NewSpecial.set('Category', 'travel') I get the error. If i copy the same exact code but instantiate the model in the console, everything works fine. I'm using the backbone-nested.js as a smart package in Meteor (I packaged it myself and will upload it to Atmosphere for community use shortly).

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

No branches or pull requests

1 participant