fix page number in redirection after updating a comment

This commit is contained in:
jomo
2015-07-11 04:14:04 +02:00
parent 4e97a9d63d
commit 3c0173f7c4

View File

@@ -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