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 6947913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:45:14+00:00 2026-05-27T13:45:14+00:00

I have notifications in my Rails & Backbone.js app // MODEL NotificationModel = App.BB.Model.extend({

  • 0

I have notifications in my Rails & Backbone.js app

// MODEL
NotificationModel = App.BB.Model.extend({
    defaults : {}
});


// COLLECTION
NotificationCollection = App.BB.Collection.extend({
    model: NotificationModel,
    url: '/notifications',

    initialize : function() {
        var me = this;
        me.fetch();
    }

});

The model has the following fields (id, read) where read is true or false.

What I want to do is once the user views the notifications, mark all as READ = true on the server. What’s the right way to do that with Backbone.js?

Thanks

  • 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-05-27T13:45:15+00:00Added an answer on May 27, 2026 at 1:45 pm

    There is no Bulk upload in Backbone.js
    so you have two choices

    1. continue to work as backbone does best,
      you can update every model in your collection to set the item as read.

      myCollection.each(function(note){
          note.set({read: true});
          note.save();
      });
      

      this will post the model to the server and update your server (for that model only)
      yes, this might seem heavy but backbone works this way, there is no bulk update of models (yet?)

    2. the other solution is to post it yourself usign a custom made Ajax call,
      for example this jQuery call.

      var oData = {models : myCollection.toJSON() };
      
      $.ajax({
          type: "POST",
          url: "my/backend/url.php",
          data: oData
      }).done(function( msg ) {
          alert( "Data Saved: " + msg );
          // your code after the post is completed...
      });
      

    keep in mind that: after this ajax call is complete you might want to fetch your collection again to update it (otherwise the models in your collection will don’t know about the changes yo u did to the server, so all models will list read: true in their changedAttributes.

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

Sidebar

Related Questions

I have a notifications model for notifications // MODEL NotificationModel = App.BB.Model.extend({ defaults :
I have a rails 3 app with paperclip. The model looks a little like:
I have a web app (.NET 3.5) which is sending notifications by email to
I have a simple rails app where user can send a mass email to
This is probably something stupid as I have never deployed a Rails app before.
We have a rails api that we would like to use to send notifications
I have some Rails web service, and iOS iPad app. This iPad app need
I have a Rails web app that is used to gather data from an
I have a rails app, where I have 2 models, user and notice. A
I have a rails 3 app, and am trying to do testing. I do

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.