title: Carrierwave upload works in Rails 4.x but not Rails 5
body: <p>I have code that I've made into a dummy test site to validate. This code works exactly as intended when using Rails (4.2.5.1) but fails when using Rails (5.0). I do not understand where the actual issue is.</p>
  
  <p>My specific error is <code>Attachment article must exist</code>, which tells me somehow I am not passing an article instance to this, but I just can't figure out why this works, exactly as is in a Rails 4.x instance but not in a Rails 5 beta and figure it must be something I haven't seen elsewhere. Hoping someone might know.</p>
  
  <p>I have an Attachment model:</p>
  
  <pre><code>class Attachment &lt; ApplicationRecord
    belongs_to :article
    mount_uploader :file, AttachmentUploader
  end
  </code></pre>
  
  <p>I have an Article model:</p>
  
  <pre><code>class Article &lt; ApplicationRecord  
    has_many :attachments, dependent: :destroy
    accepts_nested_attributes_for :attachments, reject_if: :all_blank
  end
  </code></pre>
  
  <p>I have an Articles Controller:</p>
  
  <pre><code>class ArticlesController &lt; ApplicationController
    before_action :set_article, only: [:show, :edit, :update, :destroy]
  
    # GET /articles/new
    def new
      @article = Article.new
      @article.attachments.build
    end
  
    def create
      @article = Article.new(article_params)
  
       respond_to do |format|
       if @article.save
          format.html { redirect_to @article, notice: 'Article was successfully created.' }
          format.json { render :show, status: :created, location: @article }
    else
          format.html { render :new }
          format.json { render json: @article.errors, status: :unprocessable_entity }
        end
     end
    end
  
  private
    # Use callbacks to share common setup or constraints between actions.
    def set_article
      @article = Article.find(params[:id])
    end
  
    # Never trust parameters from the scary internet, only allow the white list through.
    def article_params
      params.require(:article).permit(:name, :content, attachments_attributes: [:file, :file_cache])
     end
  end
  </code></pre>
  
  <p>My forms are as you'd expect.   My Article form:</p>
  
  <pre><code>&lt;%= form_for(article) do |f| %&gt;
    &lt;% if article.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(article.errors.count, "error") %&gt; prohibited this    article from being saved:&lt;/h2&gt;
  
    &lt;ul&gt;
    &lt;% article.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;%= f.label :name %&gt;
    &lt;%= f.text_field :name %&gt;
  &lt;/div&gt;
  
  &lt;div class="field"&gt;
    &lt;%= f.label :content %&gt;
    &lt;%= f.text_area :content %&gt;
  &lt;/div&gt;
  
  &lt;div id="attachments"&gt;
    &lt;h3&gt;Attachments&lt;/h3&gt;
    &lt;%= render partial: "attachments/form", locals: { f: f, index: 0 } %&gt;
  &lt;/div&gt;
  
  &lt;div class="actions"&gt;
    &lt;%= f.submit %&gt;
  &lt;/div&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>And my Attachments partial:</p>
  
  <pre><code>&lt;%= f.fields_for :attachments, child_index: index do |ff| %&gt;
    &lt;%= ff.file_field :file, as: :file, label: "File ##{index += 1}" %&gt;
    &lt;%= ff.hidden_field :file_cache %&gt;
  &lt;% end %&gt;
  </code></pre>