diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index df2513782..d619b1cd7 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -13,9 +13,14 @@ class StudentWorkController < ApplicationController end def new - @stundet_work = StudentWork.new - respond_to do |format| - format.html + student_work = @homework.student_works.where("user_id = ?",User.current.id).first + if student_work.nil? + @stundet_work = StudentWork.new + respond_to do |format| + format.html + end + else + render_403 end end