Ruby on Rails Friday, March 29, 2013



On Thursday, 28 March 2013 19:03:48 UTC, Bigos wrote:


I have problems with multiple file upload. I tried Paperclip with jQuery file uplad plugin and get the error mentioned in the title. Files get uploaded without problems, but I keep getting this embarrassing error...

Fixed!!!
controller:
https://github.com/bigos/chrisb-images/blob/master/app/controllers/photos_controller.rb

  def create
    @photo = Photo.new(params[:photo])

    respond_to do |format|
      if @photo.save
        format.html { render :json => [@photo.to_jq_upload].to_json,
          :content_type => 'text/html',
          :layout => false
        }
        format.json { render json: {files: [@photo.to_jq_upload] }}
      else
        format.html { render action: "new" }
        format.json { render json: @photo.errors, status: :unprocessable_entity }
      end
    end
  end




model:
https://github.com/bigos/chrisb-images/blob/master/app/models/photo.rb

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/zPcGVOFce50J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment