Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceCollection.create doesn't support multiple arguments #37

Open
jamesarosen opened this issue Jul 15, 2013 · 2 comments
Open

ResourceCollection.create doesn't support multiple arguments #37

jamesarosen opened this issue Jul 15, 2013 · 2 comments

Comments

@jamesarosen
Copy link

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
Copy link

jish commented Jul 15, 2013

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
Copy link

jish commented Jul 15, 2013

That said, we could look into dropping that requirement in 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants