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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:20:58+00:00 2026-06-10T14:20:58+00:00

I am trying to implement BackboneRelational and keep getting Cannot instantiate more than one

  • 0

I am trying to implement BackboneRelational and keep getting

“Cannot instantiate more than one Backbone.RelationalModel with the
same id per type!”

class App.Models.User extends Backbone.RelationalModel
  urlRoot : '/api/users'
  idAttribute: 'id'

  relations: [
    type: Backbone.HasMany
    key: 'plots'
    relatedModel: 'App.Models.Plot'
    collectionType: 'App.Collections.Plots'
    includeInJSON: false
    reverseRelation:
      key: 'user_id',
      includeInJSON: 'id'
  ]


class App.Models.Plot extends Backbone.RelationalModel
  urlRoot : '/api/plots'
  idAttribute: 'id'

If I switch one of the models to extends Backbone.Model I can instantiate both, but I get all the warnings that the relational functionality is broken..

I am trying to achieve the following:

 plot = new App.Models.Plot({id : 700})
 plot.fetch()
 plot.get('user')

What am I missing?

  • 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-10T14:21:00+00:00Added an answer on June 10, 2026 at 2:21 pm

    The general idea behind the “one model per id” situation is that Backbone Relational uses a data store (Backbone.Relational.store) to eliminate repeated requests for models that have already been loaded.

    Fortunately, it also provides a few helpers to help access models through the store. Instead of supplying an ID and fetching the plot, you might instead use the findOrCreate method you’ll find attached to App.Models.Plot:

    plot = App.Models.Plot.findOrCreate(700)
    user = plot.get('user')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to implement a native library into my application. But i keep getting
Im trying to implement this code: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api and want to add it to my
Trying to implement a MSMQ-backed WCF PubSub. I understand that net.msmq is one-way; however
Trying to implement an MVC pattern, keep coming back to a NullPointerException . I
I'm trying implement A* Start path finding in my games(which are written with JavaScript,
I am trying implement a most recent widget into my tumblr post. So far,
Trying to implement LoaderManager + CursorLoader. In onFinish method adapter should swap its cursor
Trying to implement google C2DM service. registrationIntent.putExtra(app, PendingIntent.getBroadcast(context,0,new Intent(), 0)); registrationIntent.putExtra(sender,example@gmail.com); context.startService(registrationIntent); Almost every
Trying to implement a search similar to here .This searches properties based on city,locality,property
Trying to implement 3-layer (not: tier, I just want to separate my project logically,

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.