Add excerpt column to topics table to remove N+1 query in ListableTopicSerializer

This commit is contained in:
Neil Lalonde
2014-03-18 13:40:40 -04:00
parent 3cf0adaed0
commit 0b1550f9d4
6 changed files with 50 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ class PostRevisor
@post.acting_user = @user
revise_post
update_category_description
update_topic_excerpt
post_process_post
update_topic_word_counts
@post.advance_draft_sequence
@@ -107,6 +108,10 @@ class PostRevisor
end
end
def update_topic_excerpt
@post.topic.update_column(:excerpt, @post.excerpt(220, strip_links: true)) if @post.post_number == 1
end
def post_process_post
@post.invalidate_oneboxes = true
@post.trigger_post_process