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

  • Home
  • SEARCH
  • 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 7752391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:47:18+00:00 2026-06-01T11:47:18+00:00

I am running Backbone js 0.9.2 on Rails 3.2.2,I have a page for adding

  • 0

I am running Backbone js 0.9.2 on Rails 3.2.2,I have a page for adding cost rows.A cost have 3 TextFields: title, description and price.

I am saving each cost on blur.

model.save() gets called multiple times with very short intervals. Which issues one create(post) request then one update(put) request shortly there after. The problem I am experiencing is that PUT request sometimes reaches the server before the POST, the result being that model gets created and persisted twice(duplicates).

To save on blur is the requested behavior, so I need a way to queue up requests.
I have read something about Spine js, and that they solve it by some kind of queue. I’ve also looked in to this, but can’t seem to figure this out.

It feels like this should be a common issue, working with “single-page-apps” but can’t find anything about it.

  • 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-01T11:47:19+00:00Added an answer on June 1, 2026 at 11:47 am

    You could override the save method and create a queue with a deferred object . For example,

    var MDef = Backbone.Model.extend({
        url: "/echo/json/?delay=3",
    
        initialize: function() {
            this.queue = $.Deferred();
            this.queue.resolve();
        },
    
        save: function(attrs,options) {
            var m = this; 
            console.log("set "+JSON.stringify(attrs));
    
            // this.queue = this.queue.pipe with jquery<1.8
            this.queue = this.queue.then(function() {
                console.log("request "+JSON.stringify(attrs));
                return Backbone.Model.prototype.save.call(m, attrs, options);
            });            
        }
    });
    
    var m = new MDef();
    m.save({title: "a title"});
    m.save({description: "a description"});
    m.save({price: "a price"});
    

    And a Fiddle : http://jsfiddle.net/nikoshr/8nEUm/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running into a problem. I have a table defined to hold the values of
Running the command generates new rails projects: $ rails generate controller home index The
I keep running into this problem over and over. I have a view with
I have two backbone Views. One is the main view and the other is
Running Rails 3.1.3... I'll use a simple example of nested associations (not sure if
running: ruby 1.9.3p0 with Rails 3.2.1 Trying to use rspec but when I try
Running IIS 6 with a main website using .net 4. I have many sub
I'm working on a backbone rails application that needs to poll the server to
I am following this backbone rails turotial . The tutorial says they are using
I have a backbone model called Member - this contains membership data such as

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.