Forum: Ruby on Rails Namespace Issues

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mauro C. (Guest)
on 2006-01-18 13:51
Abstract: It seems that the AnyModule::AnyModel shadows AnyModel.
Note: a simila post of mine appears in "Rails Engines development" as

The goal
I would like to have the model

         in apps/models/any_module/any_model.rb

managed by the controller

         in apps/controllers/any_module/any_models_controller.rb

with views
         in apps/views/any_module/any_models

I am experimentig a quite strange behavior:

1 - create a test rails application (e.g. tasklist)
2 - setup a db (e.g. tasklist_dev) with a table (e.g. categories)
3 - from RAILS_ROOT
    $ ./script generate scaffold  category
4 - run the application and
     point to http://localhost:3000/categories
    you should see the usual good stuff.
5 - $ ./script generate model  task_list/category

Now tha application is broken and you get:
"uninitialized constant Category" error.

It seems that the Task_List::Category shadows Category.
Can anybody explain why? Is it already happened to anybody else?

This topic is locked and can not be replied to.