0
레일에서 ActiveRecord에서 다음 쿼리를 작성하려고합니다.레일 용 ActiveRecord 쿼리
SELECT * FROM test_run WHERE build = '$build' AND suite='$suite'AND (result = 'fail' OR result = 'error')
AND test_name NOT IN(SELECT test_name FROM test_run WHERE result = 'pass' AND build = '$build')GROUP BY test_name";
첫 번째 부분은 쉽습니다. 부역을 수행하는 방법을 잘 모르겠습니다.
scope :never_passed, lambda { |b| where(:build => b, :status => 'fail').where(??)
위의 SQL에서 작동하도록이 하위 쿼리를 만들려면 어떤 작업을해야합니까? Arel에
감사
체크 이것을. 그것은 당신에게 두통을 저장해야합니다 : https://github.com/ernie/squeel/ – AJcodez