title: Can't resolve image into URL: to_model delegated to attachment, but attachment is nil in Rails 5.2
body: <p>I have the following form:</p>
  
  <pre><code>&lt;%= form_with(model: user, local: true) do |form| %&gt;
    &lt;% if user.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(user.errors.count, "error") %&gt; prohibited this user from being saved:&lt;/h2&gt;
  
        &lt;ul&gt;
        &lt;% user.errors.full_messages.each do |message| %&gt;
          &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
        &lt;% end %&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= form.file_field :avatar %&gt;
    &lt;/div&gt;
  
    &lt;div class="actions"&gt;
      &lt;%= form.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>It is being called on my <code>edit</code> page:</p>
  
  <pre><code>&lt;h1&gt;Upload Avatar&lt;/h1&gt;
    &lt;%= image_tag(@user.avatar) %&gt;
    &lt;%= render 'form', user: @user %&gt;
  &lt;hr&gt;
  </code></pre>
  
  <p>I get the error in the title but I am not sure why the avatar is not being attachd to the <code>user</code> model. I have all the requirements done for <code>active_storage</code>.</p>
  
  <p><code>has_one_attached :avatar</code> in <code>user model</code>.</p>
  
  <p>In <code>user controller</code>:</p>
  
  <pre><code>  def identity_params
      params.permit(:email_confirmation, :password, :password_confirmation, :avatar).to_h.symbolize_keys.tap do |params|
        params[:email] = params[:email_confirmation]
      end 
    end 
  </code></pre>
  
  <p>Also I have all the necessary migrations. Am I missing the actual avatar attaching logic?</p>