私がモデルを持っているふりをして、has_many:commentsを投稿します。コメントのある投稿のみを表示するにはどうすればよいですか?
私はnamed_scopeにある程度慣れていますが、シンボルを期待する:conditionsハッシュにPost.comments(またはself.comments)を配置する方法がわかりません。
class Post < ActiveRecord::Base
has_many :comments
named_scope :with_comments, :conditions => [#self.comments.length > 0]
end
コメント欄には何を書けばいいですか?
ありがとう!