diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index e5ca0dc1d..3eaac0648 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -44,12 +44,13 @@ class HacksController < ApplicationController begin logger.info("##########{hack_params}") hack = Hack.new(hack_params) + hack.user_id = current_user.id + hack.identifier = generate_identifier Hack, 8 ActiveRecord::Base.transaction do - hack.user_id = current_user.id - hack.identifier = generate_identifier Hack, 8 hack.save! # 创建测试集与代码 hack.hack_sets.create!(hack_sets_params) + # 新建知识点 hack_codes = hack.hack_codes.new(hack_code_params) hack_codes.modify_time = Time.now hack_codes.save!