我想知道是否可以在 Rails 中控制来自控制器的输入文本,例如,我想在进行一些验证后清理输入文本并请求关注该输入文本,如下所示:
if params[:pswd] == params[:pswd2]
flash = change_pswd('root', params[:oldPswd], params[:pswd])
if not flash.key?(:error)
redirect_to logged_in_path
end
else
flash[:error] = "New password doesn't match."
#here i want to clean the input text
#request focus for that input
render :changePassword
end