ResourceCollection.create doesn't support multiple arguments
Opened this issue · 2 comments
jamesarosen commented
e = Ember.Object.create( { x: 1 }, { y: 2 } );
e.get('x'); // 1
e.get('y'); // 2
but
c = Ember.ResourceCollection.create( { x: 1 }, { y: 2 } );
c.get('x'); // 1
c.get('y'); // undefined
Ember.Resource.extend
and Ember.ResourceCollection.extend
work. Ember.Resource.create
, like Ember.ResourceCollection.create
, does not.
jish commented
It is not supposed to. Ember Resource (for better or for worse) uses the second argument to create
internally.
Ember Objects support that syntax for dynamically mixing in functionality at the instance level. If you want mix in functionality, Ember Resource recommends that you mixin at the class level, not the instance level.
App.MyCollection = Em.ResourceCollection.extend(MyMixin, AnotherMixin, { ... });
myCollection = App.MyCollection.create();
jish commented
That said, we could look into dropping that requirement in 2.0
.