Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Question: Embedded Documents #140

@dev-inigmas

Description

@dev-inigmas

What is the correct (and simplest) means of notifying EPF about Embedded Documents? Earlier, I thought that I had figured it out; but now, I'm running into the follow issue:

SO.Foo = Ep.Model.extend
  ### Properties ###
  name:        Ep.attr 'string'
  description: Ep.attr 'string'

  ### Relationships ###
  bars: Ep.hasMany 'bar'

  ### Computed ###
  summary: ( ->
    @get('bars').mapProperty('name').join(', ')
  ).property('bars.@each.name')

SO.FooSerializer = SO.ApplicationSerializer.extend
  properties:
    bars: embedded: 'always'

SO.Bar = Ep.Model.extend
  ### Properties ###
  name: Ep.attr 'string'

  ## Parent Document
  foo: Ep.belongsTo 'foo', inverse: 'bars'

SO.FooIndexRoute = Ember.Route.extend
  model: -> @session.query 'foo'

When going to the "foo.index" route, I get the following:

Error while processing route: foo.index Cannot read property 'isEqual' of undefined TypeError: Cannot read property 'isEqual' of undefined
    at Ep.ModelArray.Ember.ArrayProxy.extend.removeObject (http://bebop.local:9494/dist/deps.js:73508:34)
    at apply (http://bebop.local:9494/dist/deps.js:31391:27)
    at superWrapper (http://bebop.local:9494/dist/deps.js:30969:15)
    at null.<anonymous> (http://bebop.local:9494/dist/deps.js:74282:50)
    at Ep.Model.reopen.suspendRelationshipObservers (http://bebop.local:9494/dist/deps.js:73210:37)
    at Ep.InverseManager.Ember.Object.extend._removeFromInverse (http://bebop.local:9494/dist/deps.js:74280:23)
    at Ep.InverseManager.Ember.Object.extend.unregisterRelationship (http://bebop.local:9494/dist/deps.js:74261:26)
    at null.<anonymous> (http://bebop.local:9494/dist/deps.js:74234:30)
    at Mixin.create.forEach (http://bebop.local:9494/dist/deps.js:39783:20)
    at null.<anonymous> (http://bebop.local:9494/dist/deps.js:74233:37) 

Anyone know what's going on?

Fyi - things seem to load fine when I don't specify an inverse. But then, EPF tries to POST/PUT the embedded document(s) separately.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions