Arranging Models

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


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

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)

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. [email protected] wrote:


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

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

Best Regards,
Warren N…
GNU (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
[email protected]
509-577-7732