# Problem with updating model

**URL:** <https://www.ruby-forum.com/t/problem-with-updating-model/52949>\
**Category:** Rails\
**Created:** [January 21, 2006, 1:19am UTC](https://www.ruby-forum.com/t/problem-with-updating-model/52949 "2006-01-21T01:19:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [January 21, 2006, 1:19am UTC](https://www.ruby-forum.com/t/problem-with-updating-model/52949/1 "2006-01-21T01:19:43Z")

</div>

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
