title: Problem rendering partial in the application layout (Rails)
body: <p>Here's the call in the <code>application.html.erb</code> file:</p>
  
  <pre><code>&lt;%= render :partial =&gt; 'tasks/_new' %&gt;
  </code></pre>
  
  <p>Here's the partial being rendered (<code>_new.html.erb</code>):</p>
  
  <pre><code>&lt;% form_for @task do |f| -%&gt;
    &lt;%= f.text_field :body %&gt;
    &lt;%= submit_tag "Submit" %&gt;
  &lt;% end -%&gt;
  </code></pre>
  
  <p>Here's the method in the 'tasks' controller:</p>
  
  <pre><code>def new
    @task = Task.new
  
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml =&gt; @task }
    end
  end
  </code></pre>
  
  <p>Here's the error message I keep getting:</p>
  
  <pre><code>Missing template tasks/__new.erb in view path app/views
  </code></pre>
  
  <p>And it says the error is in this line:</p>
  
  <pre><code>&lt;%= link_to "tasks", tasks_path %&gt; &lt;%= render :partial =&gt; 'tasks/_new' %&gt;
  </code></pre>
  
  <p>The file is in the right directory. The weird thing is that there's an
  extra <code>_</code> in the file name, in the error. When I give in and rename the
  partial to <code>__new.erb</code>, here's the error I get:</p>
  
  <pre><code>Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
  </code></pre>
  
  <p>And it says the error is in this line:</p>
  
  <pre><code>&lt;% form_for @task do |f| -%&gt;
  </code></pre>
  
  <p>I had also tried without the <code>_</code> in the code, as Petros suggested, but it returns the same error as above, <code>Called id for nil…</code>.</p>
  
  <p>What's going on?</p>