Support appending routes within the admin section by plugins

This commit is contained in:
Robin Ward
2015-01-30 13:29:32 -05:00
parent 750b27f973
commit f923d7e205
3 changed files with 48 additions and 18 deletions

View File

@ -116,16 +116,15 @@ class PostDestroyer
end
end
private
def make_previous_post_the_last_one
last_post = Post.where("topic_id = ? and id <> ?", @post.topic_id, @post.id).order('created_at desc').limit(1).first
if last_post.present?
@post.topic.update_attributes(
last_posted_at: last_post.created_at,
last_post_user_id: last_post.user_id,
highest_post_number: last_post.post_number
last_posted_at: last_post.created_at,
last_post_user_id: last_post.user_id,
highest_post_number: last_post.post_number
)
end
end