vendredi 19 juin 2015

Ember.js - Rendering additional data for a model

I have an app model and apps have an id and name.

  this.resource("apps", function() {
    this.route('show', { path: ':app_id' });
  });

I'd like to make the show view show metrics about the app, but the query is pretty intense, so I don't want to include it in the call to the index view (let's say this is a table).

I'm not sure if this is possible with ember-data because the app would already be in the store with the simplified payload and not be re-requested for the show view to get the metrics.

Then my head went to making metrics a completely different model accessible from apps/1/metrics and then making it another model and everything.

But if I sideload the data, i have to provide ID references to the metrics for a particular app. And it's hasOne so there's not really IDs as there would be for a database backed model.

What's the best way to load in additional data about a model or expand the information supplied in the show view?

The backend is Rails and this is an ember-cli project.




Aucun commentaire:

Enregistrer un commentaire