title: Carrierwave + ActiveAdmin with example for file and image field. results in "stack level too deep"
body: <p>I am attempting to create a file and image field on ActiveAdmin.  Example.</p>
  
  <p><img src="https://i.stack.imgur.com/RDeeB.png" alt="Active Admin example"></p>
  
  <blockquote>
    <p>What I have so far.</p>
  </blockquote>
  
  <ul>
  <li>Created a Migration to add file and image columns to the database.</li>
  <li>Created Active Admin and edited display form.</li>
  <li>Created the model</li>
  <li>Created 2 uploaders</li>
  </ul>
  
  <p>My code results in "stack level too deep" error.</p>
  
  <p>The weird thing is the code is exactly the same as my example which works fine.</p>
  
  <p><strong>admin/product.rb</strong></p>
  
  <pre><code>ActiveAdmin.register Product do
    permit_params :title, :image, :file
  
  form(:html =&gt; { :multipart =&gt; true }) do |f|
     f.inputs "Create Product..." do
       f.input :title
       f.input :image, :as =&gt; :file, :hint =&gt; f.template.image_tag(f.object.image.url(:thumb))
       f.input :file, :as =&gt; :file
  
     end
       f.actions
   end
  end
  </code></pre>
  
  <p><strong>models/product.rb</strong></p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
      mount_uploader :file, FileProductsUploader
      mount_uploader :image, ImageProductsUploader
  end
  </code></pre>
  
  <p><strong>uploaders/file_products_uploader.rb</strong></p>
  
  <pre><code> class FileProductsUploader &lt; CarrierWave::Uploader::Base
    storage :file
  
   def store_dir
     "#{Rails.root}/public/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
   end
  end
  </code></pre>
  
  <p><strong>uploaders/image_products_uploader.rb</strong></p>
  
  <pre><code>  class ImageProductsUploader &lt; CarrierWave::Uploader::Base
    include CarrierWave::RMagick
     storage :file
  
    def store_dir
      "#{Rails.root}/public/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
  
    version :thumb do
       process :resize_to_fit =&gt; [250, 250]
    end
  end
  </code></pre>
  
  <blockquote>
    <p><strong>Error Message</strong></p>
  </blockquote>
  
  <pre><code> SystemStackError in Admin::ProductsController#update
  
   stack level too deep
  
  {"utf8"=&gt;"✓",
  "_method"=&gt;"patch",
   "authenticity_token"=&gt;"ViiAmqH+S9XjP0wBSc7I2USEl1LXLw/N532Kd+uhNqc=",
   "product"=&gt;{"title"=&gt;"First Product",
   "image"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x50e6008 @tempfile=#   &lt;Tempfile:C:/Users/User/AppData/Local/Temp/RackMultipart20141016-7388-e5v6is&gt;,
   @original_filename="example.png", 
   @content_type="image/png",
   @headers="Content-Disposition: form-data; name=\"product[image]\";  filename=\"example.png\"\r\nContent-Type: image/png\r\n"&gt;},
  "commit"=&gt;"Update Product", 
  "id"=&gt;"1"}
  </code></pre>
  
  <p><strong>Console Error message</strong></p>
  
  <pre><code>Unpermitted parameters: utf8, _method, authenticity_token, commit, id
  Completed 500 Internal Server Error in 138ms
  
  SystemStackError (stack level too deep):
    actionpack (4.1.5) lib/action_dispatch/middleware/reloader.rb:79
  </code></pre>