diff --git a/app/adapters/species.js b/app/adapters/species.js new file mode 100644 index 0000000..2c5e29d --- /dev/null +++ b/app/adapters/species.js @@ -0,0 +1,5 @@ +import DS from 'ember-data'; + +export default DS.RESTAdapter.reopen({ + namespace: 'api' +}); diff --git a/app/models/genus.js b/app/models/genus.js index 7860531..48f6b7f 100644 --- a/app/models/genus.js +++ b/app/models/genus.js @@ -6,7 +6,8 @@ inflector.irregular('genus', 'genera'); export default DS.Model.extend({ genusName: DS.attr(), - createdAt: DS.attr(), - updatedAt: DS.attr(), - deletedAt: DS.attr() + species: DS.hasMany('species', {async: true}), + createdAt: DS.attr('date'), + updatedAt: DS.attr('date'), + deletedAt: DS.attr('date') }); diff --git a/app/models/species.js b/app/models/species.js new file mode 100644 index 0000000..cb11ed3 --- /dev/null +++ b/app/models/species.js @@ -0,0 +1,10 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + genusId: DS.attr(), + speciesName: DS.attr(), + genus: DS.belongsTo('genus', {async: true}), + createdAt: DS.attr('date'), + updatedAt: DS.attr('date'), + deletedAt: DS.attr('date') +}); diff --git a/app/router.js b/app/router.js index 3a9816c..a2be1c4 100644 --- a/app/router.js +++ b/app/router.js @@ -9,6 +9,7 @@ Router.map(function() { this.route('login'); this.route('about'); this.resource('genera'); + this.resource('species'); }); export default Router; diff --git a/app/routes/species.js b/app/routes/species.js new file mode 100644 index 0000000..aa33152 --- /dev/null +++ b/app/routes/species.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function() { + return this.store.find('species'); + } +}); diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 940c556..5a6ba9c 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -2,10 +2,13 @@