ruby on rails - Problems with nested form fields showing up -
I am trying to implement nested object form for my site, as a guide Ryan Diygal's blog I am using the post. For some reason, nested form fields do not appear in the view.
class commands & lt; ActiveRecord :: Base is_mind: accepts steps_assist_edit_data: step end class phase & lt; ActiveRecord :: Base is_to: instruction end & lt;% for form_for @instruction. Instruction_form | & Gt%; & Lt;% = instruction_form.error_messages% & gt; & Lt; P & gt; & Lt;% = instruction_form.label: Title% & gt; & Lt; Br / & gt; & Lt;% = instruction_form.text_field: Title% & gt; & Lt; / P & gt; & Lt; P & gt; & Lt;% = instruction_form.label: difficulty%> & Lt; Br / & gt; & Lt;% = instruction_form.text_field: difficulty%> & Lt; / P & gt; & Lt;% instruction_form.fields_for: What is the phase. Step_form | & Gt%; & Lt;% = step_form.label: Explanation, 'Explanation:'% & gt; & Lt;% = step_form.text_field: Explanation% & gt; & Lt;% end% & gt; & Lt; P & gt; & Lt;% = instruction_form.submit "Submit"%> & Lt; / P & gt; & Lt;% end% & gt; When I instruction_form.fields_for: steps do | Step_form | to change_form.fields_for: step do | Step_form | , form renders but when presented, I get an 'Unknown feature: step' error.
What I'm doing seems to match the tutorial. What should I check? Thank you.
What's going on in your controller? I have not read the tutorial yet, and can not seem to pull it down (below?) But are you preparing an object in memory to fill out?
In your controller, in your "new" action, make sure that you
@instruction = instruction.new @ instruction.steps.build/>This will start a
stepin memory as a "placeholder" to fill in your form. . At least this is when I useaccepts_nested_attributes_forin my controller, and it works greatI know that it works, and once I can drag the tutorial, so I may have to edit it
Comments
Post a Comment