Bug: Nested Comments - PG::GroupingError: ERROR: column "commontator_comments.created_at" must appear in the GROUP BY clause or be used in an aggregate function
Closed this issue ยท 3 comments
aurora-a-k-a-lightning commented
rails 5.2.3
commontator: 6.0.0.pre.2
postgres 11
Hi there!
We are attempting to use the nested comments feature by setting the config to :i
for comment_reply_style
and we are getting this error:
ActiveRecord::StatementInvalid in Practices#show
Showing /Users/app/views/commontator/threads/_show.html.erb where line #11 raised:
ActiveRecord::StatementInvalid in Practices#show
Showing /Users/app/views/commontator/threads/_show.html.erb where line #11 raised:
PG::GroupingError: ERROR: column "commontator_comments.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...UP BY "commontator_comments"."parent_id" ORDER BY "commontat...
^
: SELECT COUNT(*) AS count_all, "commontator_comments"."parent_id" AS commontator_comments_parent_id FROM "commontator_comments" WHERE "commontator_comments"."thread_id" = $1 AND "commontator_comments"."parent_id" = $2 GROUP BY "commontator_comments"."parent_id" ORDER BY "commontator_comments"."created_at" ASC
Extracted source (around line #11):
9
10
11
12
13
14
can_edit = thread.can_be_edited_by?(user)
comments = thread.paginated_comments(page, nil, show_all)
nested_comments = thread.nested_comments_for(user, comments, show_all)
%>
<div id="commontator-thread-<%= thread.id %>-show" class="show hidden">
Trace of template inclusion: app/views/commontator/shared/_thread.html.erb, app/views/practices/show.html.erb
Has anyone else ran into this yet?
Any help will be appreciated ๐
Thank you!
Dantemss commented
Thanks for the bug report. Should be a simple fix: changing
to usefiltered_comments
instead of ordered_comments
. I'll make a PR with a test and a fix.aurora-a-k-a-lightning commented
@Dantemss wow! Thank you for the quick reply and quick fix!!
I really appreciate it ๐
Dantemss commented
OK I released version 6.0.0 which should fix this issue. Please let me know if you run into any other issues.