2

I've tried to follow along with the Ember cast video: http://www.embercasts.com/episodes/getting-started-with-ember-model

I originally tried with the latest handlebars rc4 and ember rc6 but was receiving this error:Ember.Adapter subclasses must implement findAll

It doesn't make much sense because I can see the findAll method implementation defined in the fixture adapter source code. I tried debugging the app.js to check the App.Person.adapter but with all the gets and wrappers for mixins it wasn't very helpful.

Then I downloaded the source code from the video directly and opened the index.html in the browser and still have the same error. This was really strange since the code obviously worked for the video.

Anyways, I tried to make a jsFiddle here: http://jsfiddle.net/YCG9b/1/ to see if someone could point out what I expect to be a trivial mistake somewhere. jsFiddle didn't like loading ember-model.js from github so I pasted the whole thing into the JS section.

There is so little going on here that it seems this is likely an incompatibility between versions of libraries, some environmental thing, or a silly syntax error somewhere. My understanding is that this line App.Person.adpater = Ember.FixtureAdapter.create(); somehow isn't actually putting an adapter with a findAll method on the person model, so the subsequent call of App.Person.find() is failing.

Matt Mazzola
  • 4,593
  • 4
  • 22
  • 28

2 Answers2

1

Quite embarrassing, but I misspelled adapter...

I even quoted the line of code that had the error. :(

App.Person.adapter = Ember.FixtureAdapter.create();

Anyways, here is the updated fiddle if anyone else finds this in the future: http://jsfiddle.net/YCG9b/3/

Matt Mazzola
  • 4,593
  • 4
  • 22
  • 28
0

It looks like you're mixing up Ember Model with Ember Data (they both fill the same model void). Ember data is provided by the ember core team, ember model is by Erik Bryn who also commits regularly to Ember. They are both really good.

Ember Data requires a store, and you use DS.attr and DS.Model.extend etc...

BTW, cdnjs has a ember data if you want to link it to your jsfiddle.

Here it is fixed up: http://jsfiddle.net/PX5DV/

App.Store = DS.Store.extend({
  revision: 13,
  adapter: DS.FixtureAdapter.create()
});

App.Person = DS.Model.extend({
  id: DS.attr(),
  name: DS.attr()
});
Kingpin2k
  • 47,277
  • 10
  • 78
  • 96
  • I am aware of the two and intended to use Ember Model. I have been able to get it to work with Ember Data but based on this post from the Ember blog: http://emberjs.com/blog/2013/05/03/ember-data-progress-update.html I decided to try to "get started with Ember Model". Can you point out where you thought I was misleading or mixing the two? Then i can update the OP and make it more clear for other people. – Matt Mazzola Jul 29 '13 at 08:35