class User < ActiveRecord::Base
attr_reader :logindef login=(new_login)
@login = new_login unless !new_record?
end
end
Try this:
def login=(new_login)
write_attribute( :login, new_login ) if new_record?
end
For more info take a look at the "Overwriting default accessors"
section of the ActiveRecord::Base documentation.
http://api.rubyonrails.com/classes/ActiveRecord/Base.html
Aaron