 <p>If you are using:</p> <pre><code>&lt;%= render 'form', locals: {record: @record} %&gt; </code></pre> <p>then, you will need to use variable <code>record</code> instead of <code>@record</code> in your <code>_form.html.erb</code> as:</p> <pre><code>&lt;% unless record.nil? %&gt; </code></pre> <p><strong>Description:</strong></p> <p><code>locals: {record: @record}</code> means, <code>@record</code>'s value will be accessible by using <code>record</code> in the partial being rendered.</p>