课程动态,无对应数据时报错

This commit is contained in:
sw 2015-08-13 15:00:13 +08:00
parent 4b5022bfc6
commit 3e9f3f4e70
1 changed files with 24 additions and 22 deletions

View File

@ -682,6 +682,7 @@ module CoursesHelper
# activity = CourseActivity.first
title = ""
url = ""
if activity.course_act
case activity.course_act_type
when "Course"
title = activity.course_act.name
@ -705,6 +706,7 @@ module CoursesHelper
title = "问卷 " + activity.course_act.polls_name
url = poll_index_path(:polls_type => "Course", :polls_group_id => activity.course_id)
end
end
link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb"
end