Topic: attr_accessor woes
I must be doing something wrong (or maybe I don't understand when I'd want to be able to use attr_accessor).
I'm working on a user/authentication system. I've got a User model in user.rb, set up with validations and such.
class User < ActiveRecord::Base
validates_presence_of :password, :on => :create
validates_presence_of :password_confirmation, :on => :create
:minimum => 6,
:message => "must be at least 6 characters long.",
:on => :create
attr_accessor :password_confirmation, :active
#remainder snipped for brevity.
What I want to do, in my login action, is check to see if the user is active before setting the session[:user_id] variable. With the code as written above, any time I create a new user, even specifying :active => true in the create statement, my user details always show active as 'false'. If I set it manually via user.active = true, it doesn't make the change.
Is this the wrong time to be using attr_accessor :active? If I take that out, the create works as expected.