Ruby on Railsの新機能ですが、私は明らかにアクティブなレコード関連の問題がありますが、私自身で解決することはできません。Railsで関連付けの問題が見つかりません
その団体との3つのモデルクラスを考える:
# 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
誰が何を指摘することができます私は間違っている?
私はこれを何千回もやったことがありますし、私の他の働くhmtモデルを見ても、私が他のhas_many ... LOLを見逃しているのを見ることができませんでした... – Danny