How to use addon namespaces in 0.2.3


#1

I have a couple apps with a lot of shared code, mostly components and models. I recently ported to Ember CLI using version 0.2.2 and got everything working. Just as I finished Ember CLI 0.2.3 came out, so I upgraded, but I’m now belatedly noticing a difference with 0.2.3 that I’m not sure how to deal with.

In 0.2.2, if I create a model with ember g model user it would be created in the app/models folder. Same for adapters and serializers. But now they all get created in the addon folder instead, and there’s no passthrough object created to import them into the app folder. When the models are created this way the store doesn’t seem to find them. Is there some easy way to work around this, or to force the models to be created in the app folder?


#2

The addon/ folder is for the “internal guts” of the addon. The app/ folder is available to the hosting app. A common pattern is to write the code in addon/ and export select pieces of it in app/. See, for example, ember-infinity.


#3

Thank you, that clarifies things a lot.