I am building a JavaScript app, and have been learning JavaScript and Backbone, and have added Backbone-relational to it. It saves to a Django-tastypie REST server.
So before I was using Backbone-relational, I would create a new object, and either set the attributes when it was created, by passing them to the constructor, or passing a dictionary of attributes to the save()
method.
e.g in CoffeeScript:
myModel.save {attribute:value , foreignKey_attribute : '/api/resourceUri/'}
success ->
....
Now I have switched to Backbone-relational, it solves a lot of problems fetching the data, but I cant seem to set the foreign key attribute as before.
Either passing the dictionary to the constructor, or the save method. When I look at the object in the console, or the contents of the POST, the foreign_key
attribute is always null
.
Is there a way around this, or another way of setting the foreign_key_attribute
(given that I have the foreign key id)?