From f2b5e20840e35d5d23c3510a688fd2b1090a50fd Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Sat, 25 May 2013 17:37:23 -0700 Subject: [PATCH] Add Topic#max_post_number to find max post number --- app/models/topic.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/topic.rb b/app/models/topic.rb index 9563ddc2ec3..bd4eb19ff55 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -476,6 +476,10 @@ class Topic < ActiveRecord::Base first_post_number end + def max_post_number + posts.maximum(:post_number).to_i + end + def move_posts(moved_by, post_ids, opts) topic = nil