# File and directory layout below app/models

**URL:** <https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787>\
**Category:** Rails\
**Created:** [May 14, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787 "2006-05-14T19:11:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 14, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787/1 "2006-05-14T19:11:08Z")

</div>

I am posting this again with Subject “[Rails] …” in order to be  
caught by inbox filters 🙂

Hiall,

Is it possible to organize my model files below app/models into  
subfolders? E.g. I would like to put admin related models into their  
own subfolder. This kind of structuring works for controllers and  
views (scaffolding creates the right subfolder-model mappings), but  
app/models always stays flat. I’d really like to be able to group my  
code into logical, well packages 🙂 Yes, I come from the Java world  
🙂

cheers  
Martin

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 14, 2006, 8:46pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787/2 "2006-05-14T20:46:30Z")

</div>

Martin G. wrote:

> I am posting this again with Subject “[Rails] …” in order to be  
> caught by inbox filters 🙂

The mailing list software handles this for you, don’t worry. Your first  
message had [Rails] in the subject line as well. Sorry I can’t help you  
with your question, just thought I’d point that out.

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 14, 2006, 8:49pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787/3 "2006-05-14T20:49:40Z")

</div>

Thx anyway Jakob 🙂 Gmail is not showing [Rails] in the subject if I  
don’t put it in there myself. Do you see it twice now?

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 14, 2006, 8:53pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787/4 "2006-05-14T20:53:00Z")

</div>

Doh, a typo! In my original post, the sentence

(scaffolding creates the right subfolder-model mappings)  
should have read  
(scaffolding creates the right subfolder-module mappings)

it is exactly those subfolder-model mappings that I miss so much ^^

cheers  
Martin

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 14, 2006, 11:48pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787/5 "2006-05-14T23:48:46Z")

</div>

Hi Maurice,

Unfortunately that didn’t work. Rails complains about a missing source  
file then …

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 14, 2006, 11:15pm UTC](https://www.ruby-forum.com/t/file-and-directory-layout-below-app-models/94787/6 "2006-05-14T23:15:08Z")

</div>

Have you tried using modules? Controllers work that way… maybe models  
should be able to as well.

in app/models/admin/user.rb:

module Admin  
class User  
…  
end  
end

and see if that works for you. I’m away from my home machine now, so I  
can’t  
try it for you.
