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.
我需要改变我的用户密码。 有可能这样做:
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
Then have my change password form know to use that method to perform the update?
It has 3 fields: current password new password confirm new password
我利用Ajax显示形式错误。
幼儿园