Note that there are some explanatory texts on larger screens.

plurals
  1. PORails Screencast - Completely stuck on "fields_for"
    primarykey
    data
    text
    <p>i am following <a href="http://railscasts.com/episodes/73-complex-forms-part-1" rel="nofollow noreferrer">this simple tutorial</a> and i followed all the steps... but the browser simply doesn't show me anything i put inside the <code>fields_for</code> tag.</p> <pre><code>&lt;%= form_for :activity, :url =&gt; activities_path do |f| %&gt; &lt;% if @activity.errors.any? %&gt; &lt;div id="error_explanation"&gt; &lt;h2&gt;&lt;%= pluralize(@activity.errors.count, "error") %&gt; prohibited this activity from being saved:&lt;/h2&gt; &lt;ul&gt; &lt;% @activity.errors.full_messages.each do |msg| %&gt; &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; &lt;/div&gt; &lt;% end %&gt; &lt;div class="field"&gt; &lt;%= f.label "Foto" %&gt;&lt;br /&gt; &lt;%= f.text_field :photo %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label "Foto per la home" %&gt;&lt;br /&gt; &lt;%= f.text_field :photoHome %&gt; &lt;/div&gt; &lt;% for info in @activity.infos %&gt; This is rendered&lt;br&gt; &lt;% fields_for "activity[info_attributes][]", info do |info_form| %&gt; This is not rendered&lt;br&gt; &lt;p&gt; Titolo: &lt;%= info_form.text_field :title %&gt; &lt;/p&gt; &lt;p&gt; Descrizione: &lt;%= info_form.text_field :description %&gt; &lt;/p&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;p&gt;&lt;%= submit_tag "Create activity" %&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre> <p>The above code result is this:</p> <p><img src="https://i.stack.imgur.com/y88ht.png" alt="enter image description here"></p> <p><strong>What am i missing?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload