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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:17:46+00:00 2026-06-09T11:17:46+00:00

Using Backbone.js, I use Collections to fetch and synchronize data between the client and

  • 0

Using Backbone.js, I use Collections to fetch and synchronize data between the client and a Ruby server. That works pretty fine.

Now I would like to use it also to store data in memory (in present case, it would be a collection of articles in a cart).

Is there a way to do this without persisting data on the server nor in the local storage, ie. have the Collection living only in memory?

Whenever I try to set the collection’s url property to a null value, I am getting an Uncaught TypeError: Cannot call method ‘create’ of null. So… I guess this is not the right way to go!

If this not possible, what is the best design to have server and localStorage dealing with different classes in the same application?

  • 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-09T11:17:49+00:00Added an answer on June 9, 2026 at 11:17 am

    In the beginning is easy, just don’t use fetch() to populate the Collection and use reset() instead. Check reset() documentation.

    But maybe you start having issues with Collection.create(), Model.destroy() and so on. So you have to be careful using this methods.. maybe you can use Collection.add() instead of Collection.create(), but I don’t see good replacement for Model.destroy().

    I think the most elegant way to solve your problem should be to rewrite the sync() method for your memory Collection and Model.

    This is a very guess, written in the fine air:

    // code simplified and no tested
    var MemoryCollection = Backbone.Collection.extend({
      sync: function( method, model, options ){
        options.success.apply();
      }
    })
    

    but maybe it can help you to start working in this direction.

    If this is working you still have to use Collection.reset() instead of Collection.fetch().

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

Sidebar

Related Questions

We are using Backbone.js to build client-side UI that manipulates models shared by multiple
I am using Backbone and decided that I wanted a way to differentiate between
I'm currently using backbone boilerplate and running it on my MAMP server localhost. I
I have been using Backbone.js to act as a middleman between Wordpress (using the
I have a project that involves three frontend developers. We're going to use backbone
I have a web application that is currently using backbone.js 0.5.3 with backbone local
I’m using Backbone.js and Rails. In Backbone.js I use HTML5 push state to set
I am using fetch in the index action of the following backbone.js controller: App.Controllers.PlanMembers
Using Backbone I can fetch the Collection like below and render a Backbone View
I have a web app that I want to use Backbone.js for. I have

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.