summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2015-07-11 04:14:04 +0200
committerjomo <github@jomo.tv>2015-07-11 04:14:04 +0200
commit3c0173f7c46a6fbff71e39e86011f6daf591f8fe (patch)
tree53885cb280699f7330c87b69c1dd500d56a54e4d
parent4e97a9d63db852df7bf45dd6002b891f8158344d (diff)
fix page number in redirection after updating a comment
-rw-r--r--app/controllers/threadreplies_controller.rb2
1 files changed, 1 insertions, 1 deletions
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