diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f5c951836..e49057a5e 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -365,7 +365,7 @@ class ShixunsController < ApplicationController def create begin - @shixun = CreateShixunService.call(current_user, shixun_params, params) + @shixun = CreateShixunService.call(current_user, shixun_params, params) rescue => e logger_error("shixun_create_error: #{e.message}") tip_exception("创建实训失败!") diff --git a/app/services/shixuns/create_shixun_service.rb b/app/services/shixuns/create_shixun_service.rb index cf40c55ab..921b41931 100644 --- a/app/services/shixuns/create_shixun_service.rb +++ b/app/services/shixuns/create_shixun_service.rb @@ -11,6 +11,7 @@ class CreateShixunService < ApplicationService shixun = Shixun.new(permit_params) identifier = Util::UUID.generate_identifier(Shixun, 8) shixun.identifier= identifier + shixun.user_id = user.id main_mirror = MirrorRepository.find params[:main_type] sub_mirrors = MirrorRepository.where(id: params[:sub_type]) ActiveRecord::Base.transaction do