How to Nest a third nested_form in Rails

Asked

Viewed 40 times

0

I have the following models: Prova, Questao, Alternativa.

Being the same with the following associations:

Prova has_many :questoes

Questao belongs_to :prova

Questao has_many :alternativas

Alternativa belongs_to :questao

I’m using the gem nested_form to make the form nested, only that I am not able to make the nested_form of alternatives, given that I do not have the Controller question (as they will only be attributes within the proof controller), as I would do this nesting?

1 answer

0

Missing a line in your models/questao.Rb

accepts_nested_attributes_for :alternativas
  • I was missing a little more than that, but I figured it out, thanks!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.