Data in my object but not the db - help!

I'm a newbie learning Rails3 and this issue has my learning stopped in its tracks, so I'd greatly appreciate your help. I have a simple test app with a User model and name and email fields. In the console, if I run @test = User.create!(:name => 'Test Testman', :email => 'test@test.com') I get => #<User id: 21, name: nil, email: nil, created_at: "2011-01-09 03:48:00", updated_at: "2011-01-09 03:48:00">. Where did my name and email data go? If I check the object I just created in the console, @test.name returns => "Test Testman" so it made it that far, and it also passed my model validation. Looking at the development log, I see NIL values for these fields in the SQL. Looking at the DB, I have rows being created with IDs and dates, but no name & email. How could data be present in the object but not get written into the SQL? My environment is running Ruby 1.9.2, Rails 3.0.3 and sqlite3-ruby 1.3.2 (I updated everything in an attempt to fix this) . Anyone ever see behavior like this and know the fix?

Here's all I'm trying to do:

class User < ActiveRecord::Base   attr_accessor :name, :email

  email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

  validates :name,             :presence => true,             :length => { :maximum => 50 }

  validates :email,             :presence => true,             :format => { :with => email_regex },             :uniqueness => { :case_sensitive => false } end

I'm a newbie learning Rails3 and this issue has my learning stopped in its tracks, so I'd greatly appreciate your help. I have a simple test app with a User model and name and email fields. In the console, if I run

Don't use attr_accessor - you're replacing the activerecord accessors that store data in the database with standard ruby ones (that don't)

Fred

Thank you so much! The tutorial I was following had attr_accessible :name, :email and I had attr_accessor :name, :email I must have stared at it 100 times and not spotted the difference.