From 3c0173f7c46a6fbff71e39e86011f6daf591f8fe Mon Sep 17 00:00:00 2001 From: jomo Date: Sat, 11 Jul 2015 04:14:04 +0200 Subject: [PATCH] fix page number in redirection after updating a comment --- app/controllers/threadreplies_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/threadreplies_controller.rb b/app/controllers/threadreplies_controller.rb index 5257980..946155d 100644 --- a/app/controllers/threadreplies_controller.rb +++ b/app/controllers/threadreplies_controller.rb @@ -37,7 +37,7 @@ class ThreadrepliesController < ApplicationController if @reply.update_attributes(reply_params) @reply.send_new_reply_mail(old_content) flash[:notice] = "Reply updated!" - position = @reply.thread.replies.count - 1 + position = @reply.thread.replies.index(@reply) page = position / Kaminari.config.default_per_page + 1 redirect_to forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}" else