Hello!
I have a question on using modules with models.
If I do, for example, “script/generate controller Section::Users”
Rails creates /controllers/section/users_controller.rb which contains:
class Section::UsersController < ApplicationController
end
Then, using “script/generate model Section::User” Rails creates /
models/section/user.rb with:
class Section::User < ActiveRecord::Base
end
Now, if I try to do something like “scaffold :user” in the controller
and “set_table_name :users” in the model, browsing to “/section/
users/” I get the following error:
NameError in Section/users#index
uninitialized constant User
The same if I use something like “User.find(:all)” in the controller.
What’s the problem? Why can’t I use a module for models? There’s
surely something I haven’t considered…
Thanks,
Silvano
–
. . . Silvano S. . . .
e-mail: [email protected]
site: http://www.sistrall.it
flog: http://www.sistrall.it/flog