From d97f76952ce03476a0694a06dce2101858983533 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Dec 2019 20:41:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index e2023d78d..2cacc362e 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -69,11 +69,10 @@ class HacksController < ApplicationController # 新建 @hack.hack_sets.create!(hack_sets_params) # 更新代码 - hack_codes = @hack.hack_codes.new(hack_code_params) if params[:hack_codes][:code] != @hack.code - hack_codes.modify_time = Time.now + hack_code_params = hack_code_params.merge(modify_time: Time.now) end - hack_codes.save! + @hack.hack_codes.first.update_attributes!(hack_code_params) end render_ok rescue Exception => e