mercredi 7 septembre 2016

Ember - ember.debug.js:19746 Error: Failed to create an instance of 'adapter:application'

I am building an ember app and am attempting to connect to a rails API, to read in data from a questions end point.

These are two separate applications.

My Code is as follows:

adapters/application.js

export default DS.ActiveModelAdapter.extend({
  host: 'http://localhost:3000/api/v2'
});

models/questions.js

import DS from 'ember-data';

export default DS.Model.extend({
  text:  DS.attr('string'),
  title: DS.attr('string'),
  debateTopicId:  DS.attr('string'),
  releaseAt: DS.attr('date'),
  expiresAt:  DS.attr('date')
});

routes/questions.js

import Ember from 'ember';

export default Ember.Route.extend({
  model: function() {
    return this.store.findAll('question');
  }
});

templates/questions.hbs

<h2>This is the Questions Feed</h2>


  <h3> - </h3>


The end point I am attempting to call to is:

http://localhost:3000/api/v2/questions

I get the error:

ember.debug.js:19746 Error: Failed to create an instance of 'adapter:application'. Most likely an improperly defined class or an invalid module export.
    at instantiate (ember.debug.js:1477)
    at lookup (ember.debug.js:1336)
    at Object.lookup (ember.debug.js:1255)
    at Class.lookup (ember.debug.js:34526)
    at ContainerInstanceCache.instanceFor (container-instance-cache.js:62)
    at ContainerInstanceCache._findInstance (container-instance-cache.js:51)
    at ContainerInstanceCache.get (container-instance-cache.js:39)
    at Class.retrieveManagedInstance (store.js:2105)
    at Class.lookupAdapter (store.js:2111)
    at Class.adapterFor (store.js:2051)

Any ideas what the issue is?




Aucun commentaire:

Enregistrer un commentaire