Questions tagged [backbone-relational]

Get and set relations (one-to-one, one-to-many, many-to-one) for Backbone models.

Get and set relations (one-to-one, one-to-many, many-to-one) for Backbone models.

Resources:

256 questions
1
vote
1 answer

Rails and Backbone architecture

I have been hearing a lot about Backbone and wanted to use it for my latest project to learn it. However, I am coming from Rails background, and my experiences do not seem to translate well for Backbone. For example, I have four models which need…
1
vote
1 answer

Backbone JS Nested Models with Backbone Relational

I am trying to implement Backbone with backbone-relational. The Claim model: define(['underscore', 'backbone', 'backbone-relational', 'models/User'], function(_, Backbone, relational, User) { var Claim = Backbone.RelationalModel.extend({ …
Hard-Boiled Wonderland
  • 1,359
  • 3
  • 17
  • 32
1
vote
1 answer

How to create a nested form in backbone relational?

I would like to be able to create nested models at the same time in backbone. I know how to use backbone relational to create the parent model. Then once it is saved, I can create child models through backbone relational. However, I want to be…
jebek
  • 63
  • 3
1
vote
0 answers

Backbone Models - Working with Local related Json files

I have multiple JSON files that I want to use as data sources for my models. The json files are related to each other with id's. Eg. { "movies" : [1,4,3] } in cinemas.json is related to "movies.json" with movieId's 1,4,3. I would like to preserve…
smaira
  • 307
  • 4
  • 19
1
vote
2 answers

Backbone belongs_to has_many

Longtime Rails Dev, Backbone Noob. In my rails models, a project has many tasks and a task belongs to a project.. Standard stuff. Trying to get a project's tasks json in a collection. ExampleApp.Collections.Tasks = Backbone.Collection.extend({ …
1
vote
1 answer

Display information from Backbone.js related objects

What is the best way to display information from related objects on my Backbone.js wired front-end when on the backend these attributes are stored on separate Django models in a PostgreSQL database? I am currently using Django, Tastypie,…
1
vote
1 answer

Linking Models in Backbone-relational

How would you go about linking models using backbone-relational.js to then allow views specific to the id that the relations are keyed on? As an example, model tickets hasMany model ticketAssignments, and model ticketAssignments hasOne model user.…
JBarnes
  • 491
  • 1
  • 6
  • 15
1
vote
2 answers

Backbone outputing empty array for collection.models?

Having a problem where if I do apples = new Apples apples.fetch() console.log apples console.log apples.models console.log apples will out put the Apples Collection, with models: Array(10) listed inside the object. But, console.log apples.models…
user179169
1
vote
2 answers

Bind sub-model to view in backbone / marionette

I have a User model that has a BankAccount model and I have view who's model attribute is set to the User model and in that view's template I reference an attribute of the bank account: <%= bankAccount.get('description') || 'No linked account'…
1
vote
2 answers

Backbone View events not firing after the view is replaced, then put back on the page

Problem: Events that are set inside a view are not firing after the view is replaced with something else using $element.html(anotherView) and then put back on the page using #element.html(theView). Example: var BuggyView = Backbone.View.extend({ …
1
vote
1 answer

Define a public method in a backbone model

I need to iterate over a backbone collection and get an array of objects that are derived from the models within the collection. The problem is that I do not know how to let the collection access a method defined when creating the model definition…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
1
vote
2 answers

Templates for nested attributes with Backbone

I have an Appointment model, each instance of which has a Client. Here's my template for editing an appointment:
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
1
vote
1 answer

relation model between two models: the relational key

I would like to make a relation between two models User and Task using backbone-relational. I would like for each Task to get the User model or User attributes. The relation between the two models is the following: taskModel.creator_id =…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
1
vote
1 answer

Backbone relation model and collection.length

Let's suppose I have the following model (model1) and collection (collection1) model1.attributes = { name: 'bar' }; collection1.models = [{}, {}, {}]; It will be possible by using backbone relation to make the model1 to know about the length…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
1
vote
2 answers

Saving Entries to Database Relationship (many-to-many) Table from a Backbone Project

I currently have two Backbone models: user and project. I would like to have a Backbone view containing a form that enables the creation of a new project, and the association of currently existing users (entries from the database users table) with…
AndraD
  • 2,830
  • 6
  • 38
  • 48