Rails 3 - 很棒的嵌套集 - Comment.rebuild! - 导致错误
我在这里使用 Awesome_nested_set Rails 3 分支: https://github.com/FreakyDazio/awesome_nested_set
我我正在尝试按照安装说明重建嵌套。
我去控制台并输入:
>>Comment.rebuild!
但错误是:
ActiveRecord::StatementInvalid: PGError: ERROR: column "comments.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 2: HAVING COUNT("lft") > 1 ORDER BY comments.cr...
^
: SELECT "lft", COUNT("lft") FROM "comments" GROUP BY "lft"
HAVING COUNT("lft") > 1 ORDER BY comments.created_at DESC LIMIT 1
有什么想法或想法吗?
谢谢
I'm using the awesome_nested_set rails 3 fork here: https://github.com/FreakyDazio/awesome_nested_set
I'm trying to rebuild the nesting per the installation instructions.
I went to console and typed in:
>>Comment.rebuild!
But that errors with:
ActiveRecord::StatementInvalid: PGError: ERROR: column "comments.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 2: HAVING COUNT("lft") > 1 ORDER BY comments.cr...
^
: SELECT "lft", COUNT("lft") FROM "comments" GROUP BY "lft"
HAVING COUNT("lft") > 1 ORDER BY comments.created_at DESC LIMIT 1
Any thoughts or ideas why?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在acts_as_nested_set的另一个分支中报告了同样的问题(您似乎拥有所有运气不好:) 请参阅此错误报告。他确实提到了一个可以放入模型中的解决方法:
This same issues is reported in another fork of acts_as_nested_set (you seem to have all the bad luck. :) See this error report. He does mention a workaround you can put in your model: