通过反汇编一些C代码,我发现gcc正在使用def destroy_validation
if some_condition
errors.add(:base, "can't be destroyed cause x,y or z")
throw(:abort)
end
end
指令代替
def destroy
if @user.destroy
respond_to do |format|
format.html { redirect_to users_path, notice: ':)' }
format.json { head :no_content }
end
else
respond_to do |format|
format.html { redirect_to users_path, alert: ":( #{@user.errors[:base]}"}
end
end
end
我知道两个版本都是完全等效的但是为了调试gdb,我想改变它。我无法找到有关此主题的任何信息,因此任何提示都会有所帮助。