title: Rails 4 carrierwave gem TypeError on assign to uploader
body: <p>I'm using the carrierwave gem to set up image upload on a nested form. The uploader looks like:</p>
  
  <pre><code>class CarImageUploader &lt; CarrierWave::Uploader::Base
  
      include CarrierWave::MiniMagick
  
      if Rails.env.production?
          storage :fog
      else
          storage :file
      end
  
      def store_dir
          "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
      end
  
      def default_url
          'default-no-car-pic.png'
      end
  
      version :thumb do
          process :resize_to_fit =&gt; [50, 50]
      end
  
      def extension_white_list
          %w(jpg jpeg gif png)
      end
  
  end
  </code></pre>
  
  <p>The model looks like:</p>
  
  <pre><code>class Car &lt; ActiveRecord::Base
  
      belongs_to :user
      has_one :car_info, dependent: :destroy
      has_one :car_spec, dependent: :destroy
      accepts_nested_attributes_for :car_spec, :car_info
  
      mount_uploaders :car_images, CarImageUploader
  
      validates_associated :car_info, :car_spec, presence: true
  
  end
  </code></pre>
  
  <p>The view form:</p>
  
  <pre><code>&lt;%= form_for @car, html: { multipart: true, class: "form-horizontal" } do |f| %&gt;
  
      &lt;%= f.fields_for :car_spec do |car_spec_field| %&gt;
  
          # Fields for car_spec
  
      &lt;% end %&gt;
  
      &lt;%= f.fields_for :car_info do |car_info_field| %&gt;
  
          # Fields for car_info
  
      &lt;% end %&gt;
  
      &lt;%= f.label :images %&gt;
      &lt;%= f.file_field :images, multiple: true %&gt;
  
      &lt;%= f.submit "Add car" %&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>The <code>create</code> action in <code>CarsController</code> looks like:</p>
  
  <pre><code>@car = current_user.cars.build(car_params)
  @car.car_images = params[:car][:images]
  
  respond_to do |format|
    if @car.save
  
      format.html { redirect_to @car, notice: 'Car was successfully created.' }
      format.json { render :show, status: :created, location: @car }
    else
      format.html { render :new }
      format.json { render json: @car.errors, status: :unprocessable_entity }
    end
  end
  </code></pre>
  
  <p>This code results in <code>TypeError in CarsController#create</code> <code>can't cast Array to</code> when I submit the form. The <code>car_images</code> field was added to the <code>cars</code> table as<code>json</code> field. According to the instructions on carrierwave github this is correct, but it is throwing the above error on form submit. What is causing this error and how can I correct the code so that the form will submit?</p>