Model is not a class

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


Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it

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 Y.
http://9cays.com