Hello Silvano,
I may be oversimplifying things but why not just have:
script/generate model User
I think it can''t find Section::User because you are referencing it as
just
User. That''s not the same thing, those are two different classes.
If you did Section::User.find(:all) I''m guessing it would work?
I''m still a newbie, so someone correct me where I''m wrong.
-andy
On 11/9/05, Silvano Stralla
<silvano.stralla-4RvtM1ply7U1GQ1Ptb7lUw@public.gmane.org>
wrote:>
> 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 Stralla . . .
> e-mail: silvano.stralla-4RvtM1ply7U1GQ1Ptb7lUw@public.gmane.org
> site: http://www.sistrall.it
> flog: http://www.sistrall.it/flog
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Andrew Stone
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails