News for hackers. Stuff that matters.
Re:Ember Tutorial by baddox on Thursday June 12, 2014 @03:07PM (#7885374)
> Ember's examples on their site are always the simplest use-case.

This is really key. Even extremely common patterns that will be present in virtually every web app have no examples that I can find anywhere on the web. A great example is simple nested resources, where the URL is something like `/tv_shows/555/seasons/3/episodes/2`. Obviously, this is the page that displays info about episode 2 of season 3 of the TV show with id 555. So how do I reference the tv_show model (which I will almost certainly need to do) from the `EpisodesIndexController` or the `episodes/index` template? Do I really have to specify `needs` [0] on every controller nested under `TvShowsController`, and perhaps add a `setupController` hook to make the property easily accessible like in this tutorial [1]?

Granted, I'm pretty new to this, so maybe I'm just missing the obvious way to do this sort of thing clearly.

[0] http://emberjs.com/guides/controllers/dependencies-between-c...

[1] http://balinterdi.com/2014/02/26/a-common-resource-route-pat...

Re:Ember Tutorial by steveklabnik on Thursday June 12, 2014 @05:00PM (#7885910)
> Even extremely common patterns that will be present in virtually every web app have no examples that I can find anywhere on the web. A great example is simple nested resources, where the URL is something like `/tv_shows/555/seasons/3/episodes/2`.

http://emberjs.com/guides/routing/defining-your-routes/#toc_... ?

See also http://hashrocket.com/blog/posts/ember-routing-the-when-and-... and http://ember101.com/videos/007-nested-routes/

These are the first three results for "Ember nested routes" on Google. They're all pretty simple and straightforward. Hope that helps!

Re:Ember Tutorial by baddox on Thursday June 12, 2014 @07:00PM (#7886520)
Perhaps my wording wasn't great, but I'm talking about the specific issue that I explain later in the paragraph.
Re:Ember Tutorial by steveklabnik on Thursday June 12, 2014 @10:00PM (#7887111)
Ah, my apologies! I am also learning Ember, so I am not entirely sure. Hopefully someone else can come along and enlighten both of us.
Re:Ember Tutorial by pyre on Thursday June 12, 2014 @06:59PM (#7886513)
I have a large, complex Ember.js + Ember-Data + Flask API app, and I don't think that I use `needs` anywhere in the codebase, so I don't think it's absolutely necessary. IIRC, the documentation says that `needs` only applies to singleton controllers. If you have a controller associated with a model (vs. a view + controller + route combo), I would assume that it's not a singleton (i.e. controllers associated with a view are singletons in that Controller.init() is only called once, even when switching away and back to a view).
Re:Ember Tutorial by baddox on Sunday June 15, 2014 @03:51AM (#7894701)
To use my example of an app with URLs like "/tv_shows/555/seasons/3/episodes/2", if you're in the episodes/index controller (or template or view), how do you reference the particular season and tv_show that episode is part of?