# Using pods project layout but want models located inside a single folder?

**URL:** <https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657>\
**Category:** Uncategorized\
**Created:** [August 23, 2015, 9:32pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657 "2015-08-23T21:32:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![novascape](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@novascape](https://discuss.emberjs.com/u/novascape)\
**Post date:** [August 23, 2015, 9:32pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/1 "2015-08-23T21:32:33Z")

</div>

We are using usePods=true but we want to locate all our models inside of a single app/models folder to avoid the app folder tree from getting so long with the default way of creating a folder for each model directly inside the app folder.

We therefore want:

- app/models/customer
- app/models/order
- app/models/order-line
- etc

Is this possible currently whilst maintaining Ember 2.0 compatibility and using pods?

---

<div class="post-metadata">

**Author:** ![Panman8201](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/panman8201/32/17727_2.png) [@Panman8201](https://discuss.emberjs.com/u/Panman8201)\
**Post date:** [August 23, 2015, 9:38pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/2 "2015-08-23T21:38:27Z")

</div>

That’s the way I have it setup. When generating the model use the `-p` flag to negate the pods structure. Eg: `ember g model foo-bar -p`

You could also manually move your existing model files into the `app/models` folder too, just be sure to rename the files to the actual model name. Eg: from `app/foo-bar/model.js` to `app/models/foo-bar.js`

The Resolver will check both places, although I’m not sure which one takes precedence.

---

<div class="post-metadata">

**Author:** ![novascape](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@novascape](https://discuss.emberjs.com/u/novascape)\
**Post date:** [August 24, 2015, 12:54am UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/3 "2015-08-24T00:54:58Z")

</div>

@Panman8201 - Thanks, that works! I had mistakenly generated the models into the app/models folder where each model was put in a sub-folder inside the app/models folder and that obviously wasn’t working for me.

Your suggested method does indeed work for me and is quite a nice way to keep the models separated.

---

<div class="post-metadata">

**Author:** ![DevinRhode2](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/devinrhode2/32/14826_2.png) [@DevinRhode2](https://discuss.emberjs.com/u/DevinRhode2)\
**Post date:** [August 27, 2015, 1:27am UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/4 "2015-08-27T01:27:54Z")

</div>

If you turn on all logging in config/environment I’m pretty sure the resolver will log all of it’s lookups. iirc (from many months ago…) The pods were taking precedence. But, bottom line is, as long as you don’t have a model in both locations, the resolver will find your model, wherever it is, and use it accordingly!

---

<div class="post-metadata">

**Author:** ![trabus](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/trabus/32/14963_2.png) [@trabus](https://discuss.emberjs.com/u/trabus)\
**Post date:** [August 27, 2015, 5:01pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/5 "2015-08-27T17:01:30Z")

</div>

@novascape @Panman8201 When the next release of ember-cli goes out (likely v2.0.0), this behavior will change. This [PR](https://github.com/ember-cli/ember-cli/pull/4680) was recently merged, adding a new `--classic` flag which will generate in the classic structure. The `--pod` flag will no longer be inverted, so it will generate in pod structure regardless of the `usePods` setting.

---

<div class="post-metadata">

**Author:** ![balint](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/balint/32/12521_2.png) [@balint](https://discuss.emberjs.com/u/balint)\
**Post date:** [August 29, 2015, 6:26pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/6 "2015-08-29T18:26:07Z")

</div>

The pod structure is checked first and then the classic one.

---

<div class="post-metadata">

**Author:** ![greyhwndz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/greyhwndz/32/11246_2.png) [@greyhwndz](https://discuss.emberjs.com/u/greyhwndz)\
**Post date:** [August 30, 2015, 6:01pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/7 "2015-08-30T18:01:05Z")

</div>

@balint: What has been your current idiom with regards to organizing your codebase using pods as far as components and sub-components go? How about models, adapters & serializers?

---

<div class="post-metadata">

**Author:** ![balint](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/balint/32/12521_2.png) [@balint](https://discuss.emberjs.com/u/balint)\
**Post date:** [August 30, 2015, 6:36pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/8 "2015-08-30T18:36:34Z")

</div>

To be honest, I don’t usually use pods because I’m still on the fence about them or I get brought into a project where I don’t have a choice. When I get to pick, my main reasons for not using pods are probably 1) not sure how much they (their looking up and file structure) will still change and 2) I’m very used to the “classic” file structure from Rails and Ember and thus switching to pods would be quite a hurdle and their advantages (to me) do not justify making an effort to overcome that hurdle.

---

<div class="post-metadata">

**Author:** ![greyhwndz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/greyhwndz/32/11246_2.png) [@greyhwndz](https://discuss.emberjs.com/u/greyhwndz)\
**Post date:** [August 31, 2015, 6:00am UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/9 "2015-08-31T06:00:28Z")

</div>

I see. Thanks for sharing your thoughts @balint

---

<div class="post-metadata">

**Author:** ![greyhwndz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/greyhwndz/32/11246_2.png) [@greyhwndz](https://discuss.emberjs.com/u/greyhwndz)\
**Post date:** [August 31, 2015, 6:01am UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/10 "2015-08-31T06:01:34Z")

</div>

@Panman8201: Have you ever tried creating a custom resolver?

---

<div class="post-metadata">

**Author:** ![Panman8201](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/panman8201/32/17727_2.png) [@Panman8201](https://discuss.emberjs.com/u/Panman8201)\
**Post date:** [August 31, 2015, 6:32pm UTC](https://discuss.emberjs.com/t/using-pods-project-layout-but-want-models-located-inside-a-single-folder/8657/11 "2015-08-31T18:32:15Z")

</div>

Nope, I’ve just worked with what’s provided by the existing resolver. But I use pods for everything “route” related; routes, controllers, templates. In addition, my components (w/ template) are in their own “components” pod folder. Everything else; adapters, helpers, initializers, mixins, models, services, and styles are non-pods.
