Das Zuordnungsproblem in Rails konnte nicht gefunden werden
Ich bin ziemlich neu bei Ruby on Rails, und ich habe offensichtlich ein aktives Problem mit der Zuordnung von Datensätzen, aber ich kann es nicht alleine lösen.
Ausgehend von den drei Modellklassen mit ihren Assoziationen:
# 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
Wenn ich jedoch den Controller ausführe, um Fragen zu Anwendungsformularen hinzuzufügen, erhalte ich die Fehlermeldung:
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
Kann jemand darauf hinweisen, was ich falsch mache?