performance tweaks for rails 4.1

This commit is contained in:
r888888888
2014-04-24 22:18:14 -07:00
parent a89c57cee0
commit aab03422bc
16 changed files with 22 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ class ForumTopicsController < ApplicationController
def show
@forum_topic = ForumTopic.find(params[:id])
@forum_posts = ForumPost.search(:topic_id => @forum_topic.id).order("forum_posts.id").paginate(params[:page])
@forum_posts.all
@forum_posts.each # hack to force rails to eager load
respond_with(@forum_topic)
unless CurrentUser.user.is_anonymous?
session[:read_forum_topics] = @forum_topic.mark_as_read(read_forum_topic_ids)