项目动态关联优化(主要优化查询次数)

This commit is contained in:
huang 2016-03-25 15:58:17 +08:00
parent 9ce39d2f4a
commit e02ad85bbb
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@
</script>
<% unless forge_acts.empty? %>
<% forge_acts.each do |activity| -%>
<% forge_acts.includes(:forge_act).each do |activity| -%>
<script>
function expand_reply(container, btnid) {
var target = $(container);
@ -80,7 +80,7 @@
<%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<!--message -->
<% when "Message" %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
<!--new 新闻-->
<% when "News" %>
<% if !activity.forge_act.nil? and activity.forge_act.project %>

View File

@ -108,7 +108,7 @@
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<% activity.children.includes(:author).reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');