title: carrierwave throws "stack level too deep" error on file upload
body: <p>i have a weired problem and don't now how to debug further...</p>
  
  <p>if i upload an file with my html form i get:</p>
  
  <pre><code>SystemStackError (stack level too deep):
  </code></pre>
  
  <p>the trace is:</p>
  
  <pre><code>Started POST "/global/accounts/82" for 127.0.0.1 at 2011-07-27 10:28:03 +0200
    Processing by Global::AccountsController#update as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"tAf/cGPjW+uGgdl6J7t+IZgGsNKkVDLCCWYMFdtQd7g=", "account"=&gt;{"logo_cache"=&gt;"", "shortcut_icon"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x0000010632daa0 @original_filename="18677_265409985796_708130796_4889342_5500573_n.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"account[shortcut_icon]\"; filename=\"18677_265409985796_708130796_4889342_5500573_n.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#&lt;File:/tmp/RackMultipart20110727-3683-1yazc7m&gt;&gt;, "shortcut_icon_cache"=&gt;""}, "commit"=&gt;"Einstellungen speichern", "member"=&gt;{"cancel"=&gt;:get}, "id"=&gt;"82"}
    User Load (1.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 261 LIMIT 1
    Account Load (0.8ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 82 LIMIT 1
    SQL (2.0ms)  describe `roles_users`
    Role Load (3.8ms)  SELECT `roles`.* FROM `roles` INNER JOIN `roles_users` ON `roles`.id = `roles_users`.role_id WHERE `roles`.`name` = 'admin' AND (`roles_users`.user_id = 261 ) LIMIT 1
    Account Load (1.9ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = '***' LIMIT 1
    SQL (0.2ms)  BEGIN
    SQL (0.6ms)  SELECT 1 FROM `accounts` WHERE (LOWER(`accounts`.`subdomain`) = LOWER('***')) AND (`accounts`.id &lt;&gt; 82) LIMIT 1
    AREL (0.5ms)  UPDATE `accounts` SET `shortcut_icon` = 'aadf09e05f4db4124c62bfb9340aa9bd.jpg', `updated_at` = '2011-07-27 08:28:08' WHERE `accounts`.`id` = 82
    Account Load (0.5ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 82 LIMIT 1
    SQL (1.2ms)  ROLLBACK
  Completed   in 2831ms
  
  SystemStackError (stack level too deep):
  </code></pre>
  
  <p>analysing the trace, it seems that the file is uploaded and written to the DB:</p>
  
  <pre><code> AREL (0.5ms)  UPDATE `accounts` SET `shortcut_icon` = 'aadf09e05f4db4124c62bfb9340aa9bd.jpg', `updated_at` = '2011-07-27 08:28:08' WHERE `accounts`.`id` = 82
  </code></pre>
  
  <p>but after that it throws the error....</p>
  
  <p>testing carrierwave in the rails console:</p>
  
  <pre><code>ruby-1.9.2-p180&gt; path = "/Users/kalle/Desktop/button.png"
  ruby-1.9.2-p180&gt; u = Account.last
  ruby-1.9.2-p180&gt; u.logo = File.open(path)
   =&gt; #&lt;File:/Users/kalle/Desktop/button.png&gt; 
  ruby-1.9.2-p180&gt; u.save!
   =&gt; true 
  </code></pre>
  
  <p>works fine!</p>
  
  <p>well, i have a file upload @ another model, so the carrierwave installation works fine (similar uploader).</p>
  
  <p>testing the html form <strong>without the file filed</strong>, it works fine!</p>
  
  <p>so:</p>
  
  <ul>
  <li>Form works without file field</li>
  <li>carrierwave file upload works in the console</li>
  <li>different model, similar carrierwave uploader/config => works!</li>
  </ul>
  
  <p><strong>how can i debug further ?</strong></p>
  
  <p>thanks for any help!</p>
  
  <p>Rails 3.0.7/ruby-1.9.2-p180/carrierwave (0.5.3)</p>
  
  <p>EDIT:
  seems that it happens only on the update action.</p>
  
  <p>controller:</p>
  
  <pre><code>def update
    if current_account.update_attributes(params[:account])
      flash[:notice] = 'Successfully updated account.'
      redirect_to global_settings_path
    else
      render :action =&gt; 'edit'
    end
  end
  </code></pre>