#1333修复course网站的对作业留言回复无法成功提交的BUg

This commit is contained in:
sw 2014-10-29 09:52:33 +08:00
parent d2740c8a3a
commit 2e253d00c3
1 changed files with 3 additions and 2 deletions

View File

@ -236,11 +236,10 @@ class WordsController < ApplicationController
#modify by nwb
#添加对课程留言的支持
referer = request.headers["Referer"]
#referer = "http://forge.trustie.net/words/create_reply"
obj_id = referer.match(%r(/([0-9]{1,})(/|\?|$)))[1]
if referer.match(/project/)
obj = Project.find_by_id(obj_id)
elsif referer.match(/course/)
obj = Course.find_by_id(obj_id)
elsif referer.match(/user/)
obj = User.find_by_id(obj_id)
elsif ( referer.match(/bids/) || referer.match(/calls/) )
@ -251,6 +250,8 @@ class WordsController < ApplicationController
obj = Softapplication.find_by_id(obj_id)
elsif ( referer.match(/homework_attach/) || referer.match(/homework_attach/) ) #new added
obj = HomeworkAttach.find_by_id(obj_id)
elsif referer.match(/course/)
obj = Course.find_by_id(obj_id)
else
raise "create reply obj unknow type.#{referer}"
end