These are chat archives for canjs/canjs

Sep 2016
Nico R.
Sep 20 2016 18:23

@justinbmeyer Thanks, that worked.

Now I’m facing more complex problems:

  1. I was able to create a fixture but didn’t know how to use can.connect.superMap. I need to manually load data (from the fixture) and then manually map it, I guess there’s a way to do this considering my second issue:
  2. If I set up the routing, I loose any “second level” logic for any computed attribute.,output

BTW: I’m using 3.0.0-pre.6 since any newer version will generate an error: Uncaught ReferenceError: set is not defined.

Sep 20 2016 18:29

using 2.0.7 and trying to customize since my model's Id parameter is nested in a child Map. I tried to extend it in the Model prototype but I can't get to the call backs.

return can.Model.extend({

}, {
    destroy: function(model) {
        return this.constructor.destroy(model.Team.Id);
    save: function(model) {
        if (this.Team.Id !== false) {
            this.attr('isNew', false);
            return this.constructor.update(this.Team.Id, this);
        } else {
            return this.constructor.create(this);
    .success(function(datum) {
        //check the datum to see if I perform a model replacement
        var data = {
            message: "Success: Category updated.",
            templateId: 'alert-success-template',
            target: 'cat-form'
        can.trigger(window, 'showAlert', data);
    .fail(function(xhr, status, text) {
        var data = {};
        data.message = "Error: " + text;
        data.templateId = 'alert-danger-template'; = 'cat-form';
        can.trigger(window, 'showAlert', data);

I wrote it expecting .success .fail because .destroy works like that.

is there a gallery of projects I can read/learn from? I inherited this one and can't seem to pickup the nuances of canjs.
Justin Meyer
Sep 20 2016 19:13
@nriesco post pre.6, you write can.set
@peasfrog the best is to checkout
(though if you are using 2.0, the project might be written a bit differently)
isNew is a function
I can't remember if 2.0 allows you to totally customize the id
Nico R.
Sep 20 2016 21:00
@justinbmeyer ok, I fixed the can.set part. The way to map objects within objects to maintain their own functions accessible from the stache template is what worries me the most. My guess is that the can.connect.superMap function I’m trying to use could be the key to solve it. When is this called? How can I do some debug to see what is trying to map and what is the input received? Probably that would solve my issues. Thanks again.