Model validation giving problem

Hi,
I have a member registration form which takes a "Name", "Login",
"Password", "Confirm Password" and "Location". In the user model I have
added the validation
validate_uniqueness_of :login, validate_presence_of :password, :name,
:confirm_password.

When the member tries to register every thing working fine. I am using
same form for user to edit his information. When the user come to edit
his information we are not allowing the user to edit the password so
that we are hiding those fields.
But whenever user adds some invalid data suppose he hasn't added the
"name" then the error is shown "Name should not be blank" but with that
it also shows that "Password should not be blank". I have checked the
post data don't have the password and confirm password parameter. My
controller code is like this:-

"@member = User.find(params[:user_id])
@member.update_attributes(params[:user]) "
Can anyone have any idea how to solve this?

Thanks
Tushar

Try Some thing like this On updating Yours model Code is validating presence of confirm_password Which should not be i think.
validate_uniqueness_of :login
validate_presence_of :password, :name,
validate_confirmation_of:confirm_password.

Hi Rajeev,
I just added the model validations for understanding.

Whatever model validation you have added are same in my model.

Thanks,
Tushar

Try this in yours model

Validate :password_confirmation

def password_confirmation