저는 Ruby on Rails를 처음 사용하고 있으며 활성 레코드 연관성 문제가 분명합니다.하지만 직접 해결할 수는 없습니다.레일에서 연관 문제를 찾을 수 없습니다.
자신 협회와 함께 세 가지 모델 클래스를 감안할 때 :
# application_form.rb
class ApplicationForm < ActiveRecord::Base
has_many :questions, :through => :form_questions
end
# question.rb
class Question < ActiveRecord::Base
belongs_to :section
has_many :application_forms, :through => :form_questions
end
# form_question.rb
class FormQuestion < ActiveRecord::Base
belongs_to :question
belongs_to :application_form
belongs_to :question_type
has_many :answers, :through => :form_question_answers
end
하지만 신청서에 질문을 추가 할 수있는 컨트롤러를 실행할 때, 나는 오류 얻을 :
이ActiveRecord::HasManyThroughAssociationNotFoundError in Application_forms#show
Showing app/views/application_forms/show.html.erb where line #9 raised:
Could not find the association :form_questions in model ApplicationForm
사람이 지적 할 수 무엇 내가 잘못하고있는거야?
나는 이것을 1000 번이나했는데 심지어 다른 내 작업하는 hmt 모델을 쳐다 보면서 다른 has_many ... LOL이 누락 된 것을 볼 수 없었다 ... – Danny