|
|
@ -44,12 +44,13 @@ class HacksController < ApplicationController
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
logger.info("##########{hack_params}")
|
|
|
|
logger.info("##########{hack_params}")
|
|
|
|
hack = Hack.new(hack_params)
|
|
|
|
hack = Hack.new(hack_params)
|
|
|
|
|
|
|
|
hack.user_id = current_user.id
|
|
|
|
|
|
|
|
hack.identifier = generate_identifier Hack, 8
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
hack.user_id = current_user.id
|
|
|
|
|
|
|
|
hack.identifier = generate_identifier Hack, 8
|
|
|
|
|
|
|
|
hack.save!
|
|
|
|
hack.save!
|
|
|
|
# 创建测试集与代码
|
|
|
|
# 创建测试集与代码
|
|
|
|
hack.hack_sets.create!(hack_sets_params)
|
|
|
|
hack.hack_sets.create!(hack_sets_params)
|
|
|
|
|
|
|
|
# 新建知识点
|
|
|
|
hack_codes = hack.hack_codes.new(hack_code_params)
|
|
|
|
hack_codes = hack.hack_codes.new(hack_code_params)
|
|
|
|
hack_codes.modify_time = Time.now
|
|
|
|
hack_codes.modify_time = Time.now
|
|
|
|
hack_codes.save!
|
|
|
|
hack_codes.save!
|
|
|
|