[Rails] Re: Using an unsaved object

Eric Anderson eric at afaik.us
Wed Jan 19 01:16:24 GMT 2005


Duane Johnson wrote:
> Since ActiveRecord automatically supplies
> methods with the same names as the fields in a database table,
> "username" should exist in the @user object

My question is that if I don't want to use the helper methods why 
doesn't @usr.username work? Why does it return an error. ActiveRecord's 
initialize method would seem to indicate that the @attributes instance 
attribute will never be null. It will either be the values from the 
passed in hash or the column names from the database.

It works when editing so I know the column exists in the database and 
Rails sees it, but not when adding.

What am I missing in ActiveRecord which is causing @attributes to be 
equal to nil?

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://one.textdrive.com/pipermail/rails/attachments/20050118/24c566ac/signature.bin


More information about the Rails mailing list