Uploading data uri to Cloudinary


I’m using Heroku and I have the Cloudinary running with my project. The upload works fine, but when I try to upload some Data Uri to Cloudnary its not work. I saw the documentation and I know I have to use the function. I’m using carrierwave-data-uri to generate images from data-uri, It works locally, but when I change the code to integra with Cloudinary I get empty images on cloud

I know I have to use the function Cloudinary::Uploader.upload(photo) but it is not clear to me how can I integrate it to my function:

def upload_image

**photo = params[:picture][:photo] **

@picture = Picture.new(picture_params)

@picture.photo_data_mimetype = 'image/jpeg’

**@picture.user_id = current_user.id **

@picture.photo_data_uri = photo



who receives the data to image from javascript. If I just do Cloudinary::Uploader.upload(photo), the image is not associated with the record in my database