daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def batch
  2.     if request.post?
  3.       images = params[:images]
  4.       session[:images_to_tag] = []
  5.       images.each do |id, img|
  6.         unless img['uploaded_data'].blank?
  7.           uploaded_data = params[:images][id].delete(:uploaded_data) # pop off uploaded data
  8.          
  9.           image_attributes = params[:images][id].merge(params[:image])
  10.           @image = Image.new(image_attributes)
  11.           @image_picture = ImagePicture.new(:image_obj => @image)
  12.           @image_picture.uploaded_data = uploaded_data
  13.           @image.picture = @image_picture
  14.           @image.user = @current_user
  15.           @image.save!
  16.           session[:images_to_tag] << @image.id
  17.         end
  18.       end
  19.      
  20.       flash[:notice] = 'Your image was successfully uploaded.'
  21.       session[:image_tagging_job_key] = Image.start_tagging(session[:images_to_tag])
  22.       redirect_to :action => 'auto_tagging_progress'
  23.     end
  24.   rescue ActiveRecord::RecordInvalid
  25.     render :action=>'batch'
  26.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top