Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

123
Vistas
Making a collection so that it is optional for the model

I have a model called gamer that contains a collection called games.

I am trying to make this collection optional, but I don't think Backbone has a way of doing that.

I tried just removing it, but that causes an error because I do need the collection sometimes, just not all the time.

I was wondering, is there a way or trick of making a collection optional inside a model?

Here is the model with the collection:

export default Backbone.Model.extend({
    apUrl: '/api/gamerGroups',

    initialize() {
    
        this.games = new GroupAllowableCollection();
        this.games.url = () => this.apUrl + '/' + this.id + '/games';

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda