0

So when I call save on a new backbone model, save is sending a request to the base url defined in the model.

what I want is for save to issue a request to url/create.

the model isNew() returns true and all.

  • 1
    just define the `url` property with a function, use `isNew()` and return the appropriate string if it's new... i.e. `url/create` – Nirvana Tikku May 14 '13 at 14:30
  • 1
    That's simply not how your REST API is supposed to be built to work with Backbone. Your server should use the type of the request (here a `POST`) to know it's a new model, you shouldn't need an URL like '/create'. To know more about which URL will be used for each type of request => http://backbonejs.org/#Model-url. – Loamhoof May 14 '13 at 14:33
  • I thought url/create sent with POST was default behavior when using model.save() and isNew returns true. – Diego Castiblanco May 14 '13 at 14:35
  • @Loamhoof, doesn't mean to say one can't do it.. i've used backbone for apps that didn't have rest interfaces. – Nirvana Tikku May 14 '13 at 14:35
  • @Loamhoof thanks dude, I was mistaken in terms of restful api route conventions. – Diego Castiblanco May 14 '13 at 14:38

0 Answers0