Coder Social home page Coder Social logo

Comments (30)

stefanpenner avatar stefanpenner commented on July 17, 2024

these are 2 separate issues.

  1. ember objects not loaded during a specific phase of an ember app, end up anonymous. This is really an ember bug.
  2. having to import a FQN rather then "project local", this is more of an EAK + loader issue.

for 1 I have plans today to look into this and resolve it, but having the container itself inject the correct toString. This just mitigate the performance issue that lead to the whole anonymous name fallback existing in the first place.

for 2 some ideas exist to make the local aware of a "project local", but when "importing" ember objects within other ember objects you should be using embers own mechanism for this: e.g. this.controllerFor, this.routerFor, this.container.lookup, 'this.container.lookupFactory, and finallyneeds` and its corresponding controllers property

from ember-app-kit.

ianpetzer avatar ianpetzer commented on July 17, 2024

Ok.. Once again, thanks for the quick reply.

So, is there a way to work with Ember-Data models at the moment?

I've changed my model definitions to define toString at the class level. ie:

Project.reopenClass({
  toString: function() {
    return 'Project';
  }
});

That gets rid of the anonymous model error message, however, I can't seem to set up belongsTo or hasMany relationships working. How should the relationship be defined in order to access the other entity?

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

I got caught up working on other issues/pr's yesterday. So hopefully as time permits I can make this work correctly this week.

The way ED get's type information and grabs associations isn't really friendly with the module stuff (yet).

To work around this, we do the following: https://github.com/yapplabs/glazier/blob/master/app/main.js + https://github.com/yapplabs/glazier/blob/master/app/main.js#L14 which allows https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/relationships/belongs_to.js#L15-L25
to work.

Changes to ember's toString are planned, as is how ED loads these models.

from ember-app-kit.

ianpetzer avatar ianpetzer commented on July 17, 2024

ok cool!

Thanks so much again

On Mon, Aug 26, 2013 at 2:31 PM, Stefan Penner [email protected]:

I got caught up working on other issues/pr's yesterday. So hopefully as
time permits I can make this work correctly this week.

The way ED get's type information and grabs associations isn't really
friendly with the module stuff (yet).

To work around this, we do the following:
https://github.com/yapplabs/glazier/blob/master/app/main.js +
https://github.com/yapplabs/glazier/blob/master/app/main.js#L14 which
allows
https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/relationships/belongs_to.js#L15-L25
to work.

Changes to ember's toString are planned, as is how ED loads these models.


Reply to this email directly or view it on GitHubhttps://github.com//issues/87#issuecomment-23259173
.

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

https://github.com/emberjs/ember.js/pull/3209/files should fix the known issue here.

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

emberjs/ember.js#3209 should have fixed this, will reopen if its not.

from ember-app-kit.

twokul avatar twokul commented on July 17, 2024

@stefanpenner still seems to be an issue. I surfaced it again while working on builds.emberjs.com site

from ember-app-kit.

twokul avatar twokul commented on July 17, 2024

@stefanpenner I will try to fix and let you know

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@twokul emberjs/ember.js@ffd9314 is likely related.

Ember-data itself needs some love to work correctly, maybe we can shim something for the current ED. That being said the jj-abrams branch aims to work out of the box. (likely with the Ember.ENV.MODEL_FACTORY_INJECTIONS flipped to true.

from ember-app-kit.

joefiorini avatar joefiorini commented on July 17, 2024

So just to be clear, to make EAK work with current ember-data, do we need to set Ember.ENV.MODEL_FACTORY_INJECTIONS to true or to false and then load models via import?

from ember-app-kit.

twokul avatar twokul commented on July 17, 2024

I think it has to be set to true and you have to use jj-abrams branch

thanks,

/alex

On Sun, Sep 1, 2013 at 9:34 PM, Joe Fiorini [email protected]
wrote:

So just to be clear, to make EAK work with current ember-data, do we need to set Ember.ENV.MODEL_FACTORY_INJECTIONS to true or to false and then load models via import?

Reply to this email directly or view it on GitHub:
#87 (comment)

from ember-app-kit.

joefiorini avatar joefiorini commented on July 17, 2024

Is http://builds.emberjs.com/latest/ember-data.js from jj-abrams or master?

from ember-app-kit.

rwjblue avatar rwjblue commented on July 17, 2024

jj-abrams was merged into master last night (see emberjs/data@75f3174).

latest/ember-data.js is based on master (all the latest/ files are)

from ember-app-kit.

neojp avatar neojp commented on July 17, 2024

I can't seem to make this work, could you please do some documentation for this?

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@neojp can you please provide an example of your issue? I cannot infer what the problem is you are having.

from ember-app-kit.

neojp avatar neojp commented on July 17, 2024

@stefanpenner I'm trying to port the Ember.js' Getting Started guide to use the App Kit.

But I'm stuck in the model section. It might have something to do with the Adapter, Model injection in the Route or the Model itself. Any insight would be most appreciated.

Hopefully once this is done we can link to it from the wiki since getting started with the app kit itself seems to have quite a learning curve.

https://github.com/neojp/TodoMVC-EAK/tree/master/app

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

i'll dig in tonight.

from ember-app-kit.

neojp avatar neojp commented on July 17, 2024

Thanks @stefanpenner!

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

I did start digging in, but ended-up catching some unrelated regressions and worked on sorting them out, which kept me from actually digging in.

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@neojp using ember#1.1.0-beta.2 + ember-data-shim#1.0.0-beta.3 + placing the adapter in app/adapters/application everything appears to work. example -> stefanpenner/EAK-sratch@115fd3a

feel free to submit pr's to that project if you have failing ED examples. I'll try and resolve them asap.

from ember-app-kit.

neojp avatar neojp commented on July 17, 2024

Thanks @stefanpenner! I finally got it working and noticed you are enabling Ember-Data support with the Fixture adapter from the start, excellent.

Here is the link to the Official TodoMVC demo app port to EAK. https://github.com/neojp/TodoMVC-EAK

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@neojp ya I figured just including it by default would safe people some pains.

from ember-app-kit.

neojp avatar neojp commented on July 17, 2024

I couldn't agree more.
On Oct 1, 2013 7:40 AM, "Stefan Penner" [email protected] wrote:

@neojp https://github.com/neojp ya I figured just including it by
default would safe people some pains.


Reply to this email directly or view it on GitHubhttps://github.com//issues/87#issuecomment-25442269
.

from ember-app-kit.

KirillSuhodolov avatar KirillSuhodolov commented on July 17, 2024
model.get('constructor')

still return

(subclass of DS.Model)

and

model.toString() 

return

"<(subclass of DS.Model):ember741:null>"

from ember-app-kit.

fsmanuel avatar fsmanuel commented on July 17, 2024

@KirillSuhodolov you should add Ember.MODEL_FACTORY_INJECTIONS = true; or ENV.MODEL_FACTORY_INJECTIONS = true;

model.toString()
// => <appkit@model:balance::ember744:d9vs4> 
model.get('constructor')
// => appkit@model:balance:
model.get('constructor.typeKey')
// => balance

i guess you are looking for model.get('constructor.typeKey')

from ember-app-kit.

KirillSuhodolov avatar KirillSuhodolov commented on July 17, 2024

fsmanuel you're right
thx!

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@fsmanuel we should enable that by default in app.js

from ember-app-kit.

fsmanuel avatar fsmanuel commented on July 17, 2024

@stefanpenner right. i would prefer config/environment.js over app.js that's where i put it.

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@fsmanuel sounds even better!

from ember-app-kit.

fsmanuel avatar fsmanuel commented on July 17, 2024

@stefanpenner done

from ember-app-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.