diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb
index 4ed9fba33..51835106b 100644
--- a/app/views/welcome/_search_all_results.html.erb
+++ b/app/views/welcome/_search_all_results.html.erb
@@ -38,10 +38,19 @@
<%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %>
- 教师:<%= User.find(item.tea_id).realname %>
- 授课时间:<%= item.time.to_s + item.term%>
- 更新时间:<%= format_date(item.updated_at)%>
- <%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
+ <%= course_teacher = User.where("id = ?", item.tea_id).first if item.tea_id? %>
+ <% if course_teacher.nil? %>
+ 教师:无
+ 授课时间:<%= item.time.to_s + item.term%>
+ 更新时间:<%= format_date(item.updated_at)%>
+ 单位:无
+ <%= else %>
+ 教师:<%= User.find(item.tea_id).realname %>
+ 授课时间:<%= item.time.to_s + item.term%>
+ 更新时间:<%= format_date(item.updated_at)%>
+ <%= course_teacher.user_extensions.occupation.present? ? '单位:'+ course_teacher.user_extensions.occupation : ''%>
+ <% end %>
+
@@ -56,7 +65,8 @@
<%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %>资源
- 发布者:<%= User.find(item.author_id).login%>(<%= User.find(item.author_id).realname%>)
+ <%= item_author = User.where("id = ?", item.author_id).first if item.author_id? %>
+ 发布者:<%= item_author.nil? ? '无' : item_author.login%>(<%= item_author.realname unless item_author.nil? %>)
发布时间:<%= format_date(item.created_on)%>
下载次数:<%= item.downloads%>次
@@ -76,7 +86,8 @@
<%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%>
- 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
+ <%= project_admin = User.where("id = ?", item.user_id).first if item.user_id? %>
+ 管理人员:<%= project_admin.nil? ? '无' : project_admin.login %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
@@ -92,7 +103,8 @@
<%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%>
- 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>更新时间:<%= format_date( item.updated_at) %>
+ <%= memo_author = User.where("id = ?", item.author_id).first if item.author_id? %>
+ 发帖人:<%= memo_author.nil? ? '无' : memo_author.login %>更新时间:<%= format_date( item.updated_at) %>