Is it possible to update from an action/method other than the update action/method? For example in my users controller I already have an update method for other parts of my users account.
I need a separate one for changing my users password. Is it possible to have something like this:
def another_method_to_update
user = User.authenticate(current_user.email, params[:current_password])
if user.update_attributes(params[:user])
login user
format.js { render :js => "window.location = #{settings_account_path} " }
flash[:success] = "Password updated"
else
format.js { render :form_errors }
end
end
然后,我是否知道用这一方法进行更新?
It has 3 fields: current password new password confirm new password
我利用Ajax显示形式错误。
幼儿园