2
.includes를 수행하고 외부 왼쪽 결합을 지정하는 방법이 있습니까?레일이 포함 된 외부 왼쪽 결합 3
원래:
@post = Post.includes(:comments).where("comments.spam = ?", false).where(:id => params[:id]).first
@comments = post.comments
욕망은 모방하는 것입니다 사용하여 제외
@post = Post.find(params[:id])
@comments = post.comments.where(:spam => false)
열망 로딩 방식으로 그것을 수행하는 것 포함 (I 여러 게시물을 가지고 말한다면).
도움을 주셔서 감사합니다. 저스틴
다음 작업을 수행 할 것
나는 이런 식으로 뭔가를했다가, 여기에 있습니다 : : 그런 다음
, 당신은 할 수 있습니다 [스택 오버플로] [1] [1] : http://stackoverflow.com/questions/15441012/any-possible-way-to-add-parameters-to-on-clause-on-include-left-joins-on-rails/16551544#16551544 –