Is there a way in backbone.js to set up a new model (i.e. instantiate the class with empty attributes), without saving it back to the server?
Specifically, I have a collection which contains several items. When I want to create a new item within my collection, I call collection.create {}
. This automatically saves the empty model back to my database.
In Rails, there's a difference between Class.create
, which actually creates a database record, and Class.new
, which simply creates one in memory and has to be manually saved. I'm basically looking for a backbone equivalent.
Instead of Collection.create, use Collection.add.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With