What exactly does Ember.MODEL_FACTORY_INJECTIONS do?

I am using the Ember CLI, and by default it seems to install Ember.MODEL_FACTORY_INJECTIONS = true;in app.js.

I tried commenting on this line (and set it to false) and then my application seems to behave in some kind of strict mode. I got a bunch of unsuccessful statements because some of my Model relationships did not explicitly indicate otherwise.

This is the exact error:

You defined the 'account' relationship on (subclass of DS.Model), but multiple possible inverse relationships of type (subclass of DS.Model) were found on (subclass of DS.Model). Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses

Using the default Ember CLI application c Ember.MODEL_FACTORY_INJECTIONS = true;, I did not receive these errors. Therefore, I am convinced that this flag somehow changes the basic behavior.

I apologize!

+4
source share
1 answer

DS.Model, - , Ember Data. , , , Ember , . Ember.MODEL_FACTORY_INJECTIONS , Ember , .

Ember.getOwner(instance), ( ) . , , . MyModelClass.create() , . Ember.setOwner(), . . ApplicationInstance # ownerInjection().

let owner = Ember.getOwner(this);

User.create(
  owner.ownerInjection(),
  { username: 'rwjblue' }
)

, Ember, .

Ember.MODEL_FACTORY_INJECTIONS = true, , , .

, - , .

+5

All Articles