Nicholas,
Ruby doesn''t let you have a class and a module with the same name,
and having class Account::AuthController means that you have a module
called Account containing a class called AuthController.
Convention seems to be that you should have plural module names and
singular model names in this case; i.e. rename your
Account::AuthController to Accounts::AuthController. (Personally that
seems a little dodgy to me, but it seems to be commonly done, and it
works.)
Cheers,
Pete Yandell
http://9cays.com
On 13/04/2006, at 6:25 PM, Nicholas Wieland wrote:
> I''m trying to specify a model in a controller, but rails gives me
> "Account is not a class", where Account is my model name ...
>
> This is my model:
>
> class Account < ActiveRecord::Base
>
> validates_presence_of :email, :email_confirmation,
> :username, :password, :password_confirmation
> validates_format_of :email,
> :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
> validates_uniqueness_of :username
> validates_length_of :password, :within => 6..20
> validates_confirmation_of :email, :password
>
> def self.authenticate(username, password)
> find_first(["username=? AND password=?", username, password])
> end
>
> end
>
> and this is my controller:
>
> class Account::AuthController < ApplicationController
>
> model :account
>
> .....
>
> end
>
> I guess the problem is that I''m using a module, my controller is
> inside controllers/account/auth_controller.rb.
> I''m not able to find the mistake, my model is clearly a class ...
> Ideas ?
>
> TIA,
> ngw
> --
> Nicholas Wieland
> nicholas_wieland@yahoo.it
>
>
>
>
>
>
>
>
> ___________________________________Yahoo! Mail: gratis 1GB per i
> messaggi e allegati da 10MBhttp://mail.yahoo.it
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails