1
레일 4를 사용하고 Question_sets에 많은 질문과 질문이있는 응용 프로그램을 만들 때 많은 답이 있습니다. 이제 내가 원하는 것은 질문 집합을 통해 질문 모델의 한 특성과 응답 모델의 한 특성을 업데이트하는 것입니다.레일 4의 CollectionProxy 오브젝트?
@question_set.questions.inspect
는 출력을
OUTPUT:
ActiveRecord::Associations::CollectionProxy
[Question id: nil, title: "werewr", question_type: "Slider", description: "ewrewrew", is_shown_in_report: false, question_set_id: nil, user_id: nil, created_at: nil, updated_at: nil]
을 제공하지만 속성 중 하나를 액세스하거나이를 업데이트하려고 할 때, 그것은 "ATTRIBUTE_NAME"정의되지 않은 오류를 줄 것이다.
이 collectionproxy 객체의 속성에 액세스하는 방법을 알려줄 수 있습니다.