0

Getting an error while uploading an image with multistep form TypeError (can't dump File):

I think I am receiving this error because of following line in controller

session[:admission_params].deep_merge!(params[:admission]) if params[:admission]

Just want to add

  1. Multistep form is working fine, thanks http://railscasts.com/episodes/217-multistep-forms?view=asciicast

  2. I have tried image uploading with single step form with Carrierwave, which is also working fine, thanks http://blog.assimov.net/post/4306595758/multi-file-upload-with-uploadify-and-carrierwave-on

  3. Using rails 3.0.10, ruby 1.9.2 , carrierwave (0.5.7)

chaitanya
  • 1,974
  • 3
  • 17
  • 35

1 Answers1

2

I was using multi-step form as well, and I stumbled upon the same problem. Once in your controller (after CarrierWave did his job), I found out that params[:file] is actually an object of type ActionDispatch::Http::UploadedFile, and the content of its tempfile variable is important.

Here is what allowed me to get rid of that TypeError (can't dump file) error:

 params[:file].tempfile = nil

My environment:

  • rails-3.1.3
  • carrierwave-0.5.8
  • ruby 1.9.3
Martin Carel
  • 325
  • 4
  • 16