diff --git a/app/models/species.js b/app/models/species.js index f4906c8..c38f093 100644 --- a/app/models/species.js +++ b/app/models/species.js @@ -5,7 +5,7 @@ export default DS.Model.extend({ typeSpecies: DS.attr('boolean'), etymology: DS.attr('string'), genusName: DS.attr('string'), - strains: DS.hasMany('strain'), + strains: DS.hasMany('strain', { async: true }), totalStrains: DS.attr('number'), createdAt: DS.attr('date'), updatedAt: DS.attr('date'), diff --git a/app/models/strain.js b/app/models/strain.js index 71bf4ce..60d5d67 100644 --- a/app/models/strain.js +++ b/app/models/strain.js @@ -3,7 +3,7 @@ import Ember from 'ember'; export default DS.Model.extend({ measurements: DS.hasMany('measurements', { async: true }), - speciesName: DS.attr('string'), + species: DS.belongsTo('species', { async: true }), strainName: DS.attr('string'), typeStrain: DS.attr('boolean'), accessionNumbers: DS.attr('string'), diff --git a/app/routes/measurements/index.js b/app/routes/measurements/index.js index fdf177a..d1416be 100644 --- a/app/routes/measurements/index.js +++ b/app/routes/measurements/index.js @@ -2,6 +2,6 @@ import Ember from 'ember'; export default Ember.Route.extend({ model: function() { - return this.modelFor('strains/show').get('measurements'); + return this.modelFor('strains/show').strain.get('measurements'); } }); diff --git a/app/routes/strains/show.js b/app/routes/strains/show.js index 26d9f31..88ee2c8 100644 --- a/app/routes/strains/show.js +++ b/app/routes/strains/show.js @@ -1,4 +1,10 @@ import Ember from 'ember'; export default Ember.Route.extend({ + model: function(params) { + return Ember.RSVP.hash({ + strain: this.store.find('strain', params.strain_id), + species: this.store.findAll('species') + }); + } }); diff --git a/app/templates/components/scientific-name.hbs b/app/templates/components/scientific-name.hbs index 4683ffa..0c517d2 100644 --- a/app/templates/components/scientific-name.hbs +++ b/app/templates/components/scientific-name.hbs @@ -1 +1 @@ -{{strain.speciesName}} (strain {{strain.strainName}}) +{{strain.species.speciesName}} (strain {{strain.strainName}}) diff --git a/app/templates/components/strains/strain-details.hbs b/app/templates/components/strains/strain-details.hbs index 702fa1f..32d674e 100644 --- a/app/templates/components/strains/strain-details.hbs +++ b/app/templates/components/strains/strain-details.hbs @@ -14,7 +14,19 @@