Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Fixtures in CanJS & JSMVC

$
0
0
Hi,

I'm working with the new version of JSMVC that uses CanJS, and have a question about Models and fixtures.

I have a model as follows :

  1. $.Model.extend('Travel',
    {
                findAll : "GET fixtures/booking_list.json",
       create : 'POST fixtures/booking_list.json'
    },
    {
    });
    can.fixture("fixtures/booking_list.json", "fixtures/booking_list.json");
The findAll function works fine, but I'm having an issue when we create a new record.

I have a callback function called "created" for my model.save() call as follows :

created : function(param1, param2) {
}

With the previous version of JSMVC, this function used to receive the newly created object as a parameter.

However now in the new version, instead of returning just the newly created object, I get back the entire object array that was in my json file. This is because of my url I think (create : 'POST fixtures/booking_list.json'). This just makes another call to the JSON file.

Is there a way that I can specify the URL for the create method with fixtures, similar to what we had in the earlier version ? This is how it used to be : It doesnt seem to work with the new jsmvc version.

  1.  create : {fixture: "-restCreate"},

Thanks in advance!

Viewing all articles
Browse latest Browse all 3491

Trending Articles