@user.username=params[:username]
if @user.update_attribute(:email,params[:email])
flash[:notice]="successful"
else
flash[:notice]="fail"
end
above code can update username and email field.
because update_attribute can update dirty fields.
but it is a pity, update_attribute would skip validation.