Access denied, Please sign in and make sure you have proper permission.
article 和 comment 是 has_many 的关系吧?
你这样是想取出什么呢?
所有
article.comments.map { |comment| comment.content }
某个 comment
article.comments.find(id).content
#4 楼 @a4652097 comment 求和是指什么?
如果是想知道多少条 comments 的话,article.comments.size
。
楼主需要补补基础,看 tutorial 那本书吧。
竟然用 article.comments.map { |comment| comment.content }
而不是 article.comments.pluck(:content)