Skip to content

Make alias for on ObjectController and alias for on ArrayController - #1702

Closed
bcardarella wants to merge 1 commit into
emberjs:masterfrom
bcardarella:model_aliases
Closed

bcardarella wants to merge 1 commit into
emberjs:masterfrom
bcardarella:model_aliases

Conversation

@bcardarella

Copy link
Copy Markdown
Contributor

This is a follow up to 49dd221

@lukemelia

Copy link
Copy Markdown
Member

I like the thinking. I would prefer collection be the property name on ArrayController.

And to use Ember.alias to implement.

@bcardarella

Copy link
Copy Markdown
Contributor Author

@lukemelia I'll be pushing a change in a moment with this and tests

@bcardarella

Copy link
Copy Markdown
Contributor Author

I'm not sure what is special about the content property but Ember is not allowing me to alias it. I can alias computed properties, other functions, and string literals without issue but when I alias content I get null. Any thoughts? /cc @wycats

@wycats

wycats commented Jan 7, 2013

Copy link
Copy Markdown
Member

The concern I have about this is that in the Route, you use the model hook for both. It seems weird to use the model hook in the route but a models hook in the controller.

Also, I think of the Array as the "model" for the template, even though the model happens to be an Array.

@wycats

wycats commented Jan 7, 2013

Copy link
Copy Markdown
Member

Thoughts?

@bcardarella

Copy link
Copy Markdown
Contributor Author

Why not auto-set the controller's model property if the Router has a model assigned? This would clean up ome coe and is a pattern that everybody is doing already

@bcardarella

Copy link
Copy Markdown
Contributor Author

Also, I feel that either models or collection will be preferred over the singular model for the ArrayController. I like @lukemelia's collection suggestion. But, I can see where the vocabulary is getting too "backbone-y"

@tchak

tchak commented Jan 7, 2013

Copy link
Copy Markdown
Member

I think it should model, if you want collection, then singular should be record or resource. model is kind of generic.

@bcardarella

Copy link
Copy Markdown
Contributor Author

I slept on it, I agree with @wycats and @tchak that model is ideal for both situations.

@bcardarella bcardarella closed this Jan 7, 2013
@lukemelia

Copy link
Copy Markdown
Member

I came to the same conclusion. :)

ef4 pushed a commit that referenced this pull request Jan 6, 2026
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

Successfully merging this pull request may close these issues.

4 participants