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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:47:49+00:00 2026-05-26T20:47:49+00:00

I have a situation which has to be simple to solve, I would guess.

  • 0

I have a situation which has to be simple to solve, I would guess. Surely people are using Backbone Relational with CoffeeScript out there…

Here’s a model I have:

class MyCompany.Models.Establishment extends Backbone.RelationalModel
  defaults:
    name: null

class MyCompany.Collections.EstablishmentsCollection extends Backbone.Collection
  model: MyCompany.Models.Establishment
  url: '/establishments'

I haven’t even added any relationships yet, just extended RelationalModel. Now through the console when I issue a destroy on an instance of the model it successfully destroys the model on the server, but when complete it fails with the trace:

Uncaught TypeError: Object #<Establishment> has no method 'getCollection'
    _.extend.unregister
    Backbone.Events.trigger
    Backbone.RelationalModel.Backbone.Model.extend.trigger
    _.extend.destroy.options.success
    jQuery.extend._Deferred.deferred.resolveWith
    done
    jQuery.ajaxTransport.send.callback

It’s dying in line 235 of backbone-relational.js 0.4.0 because “this” is the model, I guess, instead of whatever it’s supposed to be, and the model doesn’t have a method “getCollection”.

Any ideas what I’m doing wrong, or should I report a bug? For reference, here’s the Javascript coffee generates:

(function() {
  var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
    for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
    function ctor() { this.constructor = child; }
    ctor.prototype = parent.prototype;
    child.prototype = new ctor;
    child.__super__ = parent.prototype;
    return child;
  };
  MyCompany.Models.Establishment = (function() {
    __extends(Establishment, Backbone.RelationalModel);
    function Establishment() {
      Establishment.__super__.constructor.apply(this, arguments);
    }
    Establishment.prototype.defaults = {
      name: null
    };
    return Establishment;
  })();
  MyCompany.Collections.EstablishmentsCollection = (function() {
    __extends(EstablishmentsCollection, Backbone.Collection);
    function EstablishmentsCollection() {
      EstablishmentsCollection.__super__.constructor.apply(this, arguments);
    }
    EstablishmentsCollection.prototype.model = MyCompany.Models.Establishment;
    EstablishmentsCollection.prototype.url = '/establishments';
    return EstablishmentsCollection;
  })();
}).call(this);
  • 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-26T20:47:50+00:00Added an answer on May 26, 2026 at 8:47 pm

    You need to update the underlying Backbone.js version. Here’s why:

    Your error comes from this having the wrong value when unregister is called. unregister is called in response to an event bound from register:

    model.bind( 'destroy', this.unregister, this );
    

    That third argument sets the context. But that feature was only added as recently as Backbone 0.5.2, as the changelog shows.

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

Sidebar

Related Questions

Here's the situation I have a webpage which has one drop down called prefer.
I have a situation in which the ideal relationship, I believe, would involve Value
I have a simple, real life problem I want to solve using an OO
My situation is essentially this: I have a class called Foo which has dependencies
I have a div which has some text, but according to different situations this
I have situation in which I read a record from a database. And if
I have a situation in which a managed DLL calls some unmanaged DLL. I
I have a situation in which I need to convert a text data into
I have a situation in which user can single tap a control, which show
I have a situation in which I am putting the UITableView in editing mode,

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.