Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:17:57+00:00 2026-06-15T10:17:57+00:00

Backbone’s model.save() method has the following signature: model.save([attributes], [options]) I want to call it,

  • 0

Backbone’s model.save() method has the following signature:

model.save([attributes], [options])

I want to call it, but I don’t want to pass in any attributes, only options. I need it this way because I set the attributes before saving using model.set(attributes).

How can I pass in just one object to model.save() but indicate that it is the options object and not the attributes object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:17:59+00:00Added an answer on June 15, 2026 at 10:17 am

    The documentation is explicit on this so we have to look at the source:

    save: function(key, val, options) {
      var attrs, current, done;
    
      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (key == null || _.isObject(key)) {
        attrs = key;
        options = val;
      } else if (key != null) {
        (attrs = {})[key] = val;
      }
    

    And below that you’ll see various if (attrs ...) checks. So if you say

    m.save(null, options)
    

    you’ll save the model as-is and you’ll be able to set your options. Furthermore, if you say this:

    m.save(some_attrs, options);
    

    then that is (more or less) the same as:

    m.set(some_attrs);
    m.save(null, options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Backbone.js provides a navigate(fragment, [options]) method for its Backbone.router objects, which does the following
I'm saving a backbone.js model using the model.save() method, which fires a PUT request
I use backbone.js' s model. When i save the model, it sends HTTP OPTIONS
Assume a Backbone model with the following attributes: - subtotal - discount - total
Backbone,Node : when i call fetch method, fetch is successful in server but when
A Backbone app which I'm developing has a collection and a model, and associated
I have a backbone-Model. With model.set() I can set a local value, with model.save()
My backbone.js model has a json object in defaults like this: test: { testArr:
In backbone it seems that I have to get model attributes via model.get('att_name') I'd
Using Backbone.model, I would like to change the get method in order to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.