getoutreach / epf

A framework for keeping your Ember.js apps in sync.
http://epf.io
MIT License
369 stars 33 forks source link

find/load/query by model class #83

Closed heartsentwined closed 10 years ago

heartsentwined commented 11 years ago

This throws an error:

App.__container__.lookup('session:main').find(App.Foo, 1);

screenshot from 2013-08-30 15 25 27

This doesn't:

App.__container__.lookup('session:main').find('foo', 1);

However, the former is called in the static modelClass.find() method, where this - referring to the class itself - is passed into session.find(). Although epf prefers querying by string key lookup, the latter static support has been officially declared as part of epf in order to maintain compatibility of implicit ember behaviors.

Either the session.find() call should be fixed to accept a polymorphic first argument (class or string), or the modelClass.find() method should explicitly do a class-to-type conversion, and pass the string to session.find(). In the latter case, the docs should be updated to reflect that querying by class would not work.

ghempton commented 11 years ago

Hmm App.__container__.lookup('session:main').find(App.Foo, 1); should work actually. Most of the session methods check to see if the argument is a string. Not sure what the actual issue is here.

heartsentwined commented 11 years ago

Thanks for your reply @ghempton, I'll do some more debugging on my side and see if I can isolate the problem. Just to note, #84 is reported based on observation from my same setup, so there's a chance that it's not epf's problem either...

heartsentwined commented 11 years ago

I restarted the server, and it Just Worked. Not sure what happened. Sorry for this issue report.

EDIT: No, it doesn't work - see comment below.

heartsentwined commented 11 years ago

On a side note, I created a barebones setup to test #84, and the reported behavior is independently observed. So it's not related to this setup.

heartsentwined commented 11 years ago

Edit: I take that back. I didn't realize the ember version has changed. When I put 1.0.0.rc8 back, the error pops up. git bisect gives the same emberjs/ember.js@7c9e714 as the first breaking commit as #84.

ghempton commented 10 years ago

Is this still an issue on the latest version of epf? Our app is running off of Ember.js master

heartsentwined commented 10 years ago

Issue no longer present with

ember-source 1.0.0
epf-source 0.1.3

(gem versions)

ghempton commented 10 years ago

I actually just bumped the version and cut another source gem.

heartsentwined commented 10 years ago

Thanks! I'll test the new version later.