def edit_profile
@user = session[:user]
if request.post?
@user.update_attributes(:first_name=>params[:user][:first_name]) if params[:user][:first_name] != @user.first_name
@user.update_attributes(:last_name=>params[:user][:last_name]) if params[:user][:last_name] != @user.last_name
@user.update_attributes(:email=>params[:user][:email]) if params[:user][:email] != @user.email
if (!params[:user][:password].empty?)
flash[:notice] = "Password must not have been empty"
@user.update_attributes(:password=>params[:user][:password])
@user.update_attributes(:password_confirmation => params[:user][:password_confirmation])
end
if @user.save
flash[:notice] = "Profile has been saved"
session[:user] = @user
end
end
end
It should allow the password to be blank :( why isn't it working. Instead it's using validation to tell me that the password isn't allowed to be blank.