Re: desperate, errors with file upload

PeterI
Mon, 06 Jun 2011 10:32:26 -0000

Problem SOLVED !!!

the error was cased in my UploadController when printing the
ActiveRecord errors in the flash[:errors]. this made rails dump the
hole object (including the file) in the error flash. this is one more
reason to use the helper method <%=  error_messages_for :my_controller
%>
instead of displaying it in a flash[:error]


> >   def create
> >     @upload_item = UploadItem.new(params[:upload_item])
> >     @upload_item.story = current_user.story.first
>
> >     if @upload_item.save
> >       flash[:notice] = "Upload completed"
> >       redirect_to user_url(current_user)
> >     else
> >       flash[:error] = @upload_item.errors      <-- this line caused
the error!!!
> >       render :action => new
> >     end
> >   end