1

I'm sort of new to MVC applications in general and Ember specifically.

I'm writing a simple dashboard application with Ember. The application is gathering data using JSON queries from several external sources. The first iteration of this application only uses one route and one model, since I don't need interaction in that way. Like this reply, I'm using the RSVP.hash function to collect all the data. On a given timer it would refresh the model by making all the queries again.

App.IndexRoute = Ember.Route.extend({
  model: function() {
    return new Ember.RSVP.hash({
      releaseInfo: getReleaseInfo(),
      buildResults: getSomeExternalResults(),
      autotestResults: getSomeOtherExternalResults(),
    });
  },
  actions: {
    didTransition: function() {
      _this = this;
      Ember.run.later(function() {
        _this.refresh();
      }, 1000 * 60 * 5);
    },
  },
});

One thing I would like to try is to make each type of result into it's own independent model so they can be fetched and updated independently. How do you architect your application for this scenario? As far as I understand from the Ember Guide, one route corresponds to one controller and model?

I read in one thread that views could be used, but can different views have different models? Is there other solutions that you can think of?

Thankful for any input

Community
  • 1
  • 1
  • I think I should add that the submodels in this case are totally unrelated and there is no need for interaction between them, that's why I would rather treat them as totally independent data results. – Johan Åkesson Nov 27 '14 at 19:02

0 Answers0