# Arranging Models

**URL:** <https://www.ruby-forum.com/t/arranging-models/53749>\
**Category:** Rails\
**Created:** [February 14, 2006, 6:04am UTC](https://www.ruby-forum.com/t/arranging-models/53749 "2006-02-14T06:04:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siva\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@Siva\_J](https://www.ruby-forum.com/u/Siva_J)\
**Post date:** [February 14, 2006, 6:04am UTC](https://www.ruby-forum.com/t/arranging-models/53749/1 "2006-02-14T06:04:00Z")

</div>

I know we could arrange controllers as modules. Can we also arrange  
models  
in modules?

–  
Rgds,  
–Siva J.  
[http://www.varcasa.com/](http://www.varcasa.com/)  
My First Rails Project.  
Education Through Collabration

---

<div class="post-metadata">

**Author:** ![Siva\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@Siva\_J](https://www.ruby-forum.com/u/Siva_J)\
**Post date:** [February 14, 2006, 6:35am UTC](https://www.ruby-forum.com/t/arranging-models/53749/2 "2006-02-14T06:35:26Z")

</div>

On 13-Feb-06, at 9:03 PM, Siva J. wrote:

> I know we could arrange controllers as modules. Can we also arrange  
> models in modules?

No you cannot. I dont see the need why any one would want to do it too.

Have you looked at components?

Best Regards,  
Warren N…  
GNU ([http://www.gnu.org.in](http://www.gnu.org.in))

---

<div class="post-metadata">

**Author:** ![Siva\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@Siva\_J](https://www.ruby-forum.com/u/Siva_J)\
**Post date:** [February 14, 2006, 6:39am UTC](https://www.ruby-forum.com/t/arranging-models/53749/3 "2006-02-14T06:39:57Z")

</div>

The reason I need is it package (make a module) for group of related  
modules. Something like a package in java

On 2/14/06, Warren N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

–  
Rgds,  
–Siva J.  
[http://www.varcasa.com/](http://www.varcasa.com/)  
My First Rails Project.  
Education Through Collabration

---

<div class="post-metadata">

**Author:** ![Siva\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@Siva\_J](https://www.ruby-forum.com/u/Siva_J)\
**Post date:** [February 14, 2006, 5:03pm UTC](https://www.ruby-forum.com/t/arranging-models/53749/4 "2006-02-14T17:03:27Z")

</div>

On Feb 13, 2006, at 9:34 PM, Warren N. wrote:

> Best Regards,  
> Warren N…  
> GNU ([http://www.gnu.org.in](http://www.gnu.org.in))

```
Actually yes you can do that. There is support built into edge rails

```

recently to enable using modules as namespaces for your models. Here  
is what you have to do if you are running 1.0.0. Add this line in  
side the environment.rb file inside the Rails::Initializer.run do |  
config| block:

# Add support to use models in modules for namespaces.

config.controller\_paths \<\< File.join(::RAILS\_ROOT, ‘app’, ‘models’)

```
Its a little weird becuase you use controller_paths but it will let

```

you use Admin::Page \< AR::Base for your models to have them  
namespaced inside of modules.

```
This is the same way that components are able to load their models

```

and stuff. There has been support recently added to use this by  
default on edge rails.

Cheers-  
-Ezra Z.  
WebMaster  
Yakima Herald-Republic Newspaper  
removed\_email\_address@domain.invalid  
509-577-7732
