a guest Mar 13th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def batch
- if request.post?
- images = params[:images]
- session[:images_to_tag] = 
- images.each do |id, img|
- unless img['uploaded_data'].blank?
- uploaded_data = params[:images][id].delete(:uploaded_data) # pop off uploaded data
- image_attributes = params[:images][id].merge(params[:image])
- @image = Image.new(image_attributes)
- @image_picture = ImagePicture.new(:image_obj => @image)
- @image_picture.uploaded_data = uploaded_data
- @image.picture = @image_picture
- @image.user = @current_user
- session[:images_to_tag] << @image.id
- flash[:notice] = 'Your image was successfully uploaded.'
- session[:image_tagging_job_key] = Image.start_tagging(session[:images_to_tag])
- redirect_to :action => 'auto_tagging_progress'
- rescue ActiveRecord::RecordInvalid
- render :action=>'batch'
RAW Paste Data