已经创建过作品的用户不允许重复创建
This commit is contained in:
parent
8c72df74d6
commit
bf63ca7854
|
@ -13,10 +13,15 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
student_work = @homework.student_works.where("user_id = ?",User.current.id).first
|
||||||
|
if student_work.nil?
|
||||||
@stundet_work = StudentWork.new
|
@stundet_work = StudentWork.new
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
Loading…
Reference in New Issue