Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Error defining relations #378

ddxtreme opened this Issue · 3 comments

3 participants


Hi there,

I am with toruble difinig relations, here is what i have:

class Entities.Trainer extends Backbone.RelationalModel
--urlRoot: -> Routes.trainers_path()
----type: Backbone.HasMany
----key: 'emails'
----relatedModel: Entities.Email
------key: 'trainer'
------includeInJSON: 'id'

class Entities.Email extends Backbone.RelationalModel
--urlRoot: -> Routes.emails_path()

when i refresh the page i see a bunch of warning in console:

Relation=function (){ return parent.apply(this, arguments); }; missing or invalid relation type!

Relation="emails"; missing or invalid relation type!

Relation=function Email() {
ref = Email.__super_.constructor.apply(this, arguments);
return _ref;
}; missing or invalid relation type!
Relation= Object; missing or invalid relation type!

Can someone help me? Thanks


Please try to file a jsFiddle with a running, reduced test case. That will vastly increase chances of the issue you're experiencing being solved!

@PaulUithol PaulUithol closed this

@ddxtreme I have the same issue with defining relations, have you sorted this problem out? If so, please let me know.


@ddxtreme I think i found the solution. Please consider this code:

class Entities.Trainer extends Backbone.RelationalModel
  urlRoot: -> Routes.trainers_path()
  relations: [{
    type: Backbone.HasMany
    key: 'emails'
    relatedModel: Entities.Email
      key: 'trainer'
      includeInJSON: 'id'

I hope it would help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.