Problem with updating model


#1

I trying to update DATE type field in MySQL but such errors occurs

errors:
password_confirmation:
- “can’t be blank”
birthday:
- “can’t be blank”

Spending hours on that, I cann’t find the reason

But I’ve filled “login” “password” “password_confirmation” and
“birthday” fields right.
Also I want password field to be blank, not 40 digit hashed password,
but all others fields to be as they are (retrieved from database table
by ActiveRecord)
So, what’s the problem with updating the “birthday” record, and how to
make the password field to be blank?
Thanks a lot.

== template
<%= start_form_tag :action=> “edit” %>
<%= hidden_field “post”, “id”, :value => @edituser.id %>
<%= text_field “edituser”, ‘login’, :size => 30 %>
<%= password_field “edituser”, ‘password’, :size => 30 %>
<%= password_field “edituser”, ‘password_confirmation’, :size => 30 %>
<%= date_select(“edituser”, ‘birthday’, :order => [:day, :month,
:year], :start_year => 1931, :end_year => 2001) %>
<%= end_form_tag %>

== controller
def edit
@edituser = User.find_first([“id = ?”,params[:id]])
if @request.post?
if not @edituser.nil?
@edituser.login = @params[:edituser][:login]
@edituser.birthday = @params[:edituser][:birthday]
@edituser.login = @params[:edituser][:login]
if not @params[:edituser][:password].nil? and
@params[:edituser][:password] ==
@params[:edituser][:password_confirmation] and
@params[:edituser][:password] != “”
@edituser.password = @params[:edituser][:password]
end
end
end
end

== model user
attr_accessor :password_confirmation
validates_confirmation_of :password
validates_presence_of :login, :password, :password_confirmation,
:birthday

== MySQL table users
id int
login varchar(40)
password varchar(40)
birthday DATE