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

Knockback fails when model has attribute called 'url' #134

Closed
patrick-radius opened this issue Sep 7, 2014 · 2 comments
Closed

Knockback fails when model has attribute called 'url' #134

patrick-radius opened this issue Sep 7, 2014 · 2 comments

Comments

@patrick-radius
Copy link

Hi, i was just testing out kb to see if it is useful for our project.
But at the first try i got this weird issue.

when i have a backbone model with an attribute called url it fails with an undefined is not a function at line 1217 in knockback.js

The function in your code is: kb.getValue = function(model, key, args) {
        var _ref;
        if (!model) {
          return;
        }
        if (_.isFunction(model[key]) && ((_ref = kb.orm) != null ? _ref.useFunction(model, key) : void 0)) {
          return model[key]();
        }
        if (!args) {
          return model.get(key);
        }
        return model.get.apply(model, _.map([key].concat(args), function(value) {
          return kb.peek(value);
        }));
      };

I suspect it is related to the _ref.useFunction call.
I'm using Backbone Associations, but not in this particular model.
I also tried calling it like this (where m is the original model)

            this.view_model = kb.viewModel( new Backbone.Model(m.toJSON()) );

but it still fails, unless i call the url attribute something else.

@kmalakoff
Copy link
Owner

Hmmmm. I've never used an attribute called url. I can write a test for this case.

kmalakoff pushed a commit that referenced this issue Sep 21, 2014
@kmalakoff
Copy link
Owner

I've fixed it in knockback 0.20.2. Happy coding!

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

2 participants