0
자식 노드가 referering하는 개체를 가져 오려고합니다. 그래서 쿼리를 만들 수 있습니다.rable에서 자식 "현재"개체에 액세스
이child @course_types => :course_types do |course_type|
attributes :id, :name, :deleted
child CourseTypeCategory.where(course_type: course_type, active: true) => :category_position do
attributes :category_id, :position
end
end
course_type
나는 생각한다 (이 경우 항상 렌더링되는 각 유형과 동일한 것처럼 CourseTypeCategory.where(course_type: course_type, active: true)
항상 같은 결과를 반환이 쿼리의 결과는 항상 있습니다 :
내 코드는 다음과 같습니다 @course_types의 첫 번째 객체). 자녀의 "현재 객체"를 얻고 루프를 수행하는 것처럼 쿼리를 작성하는 방법이 있습니까 (each do
과 같은)?
미리 감사드립니다. 질문이 혼란 스럽다면 죄송합니다.
감사합니다. – InesM