I've just integrated cloudinary into my rails project and created a view to allow the user to upload an image file.
In my controller I have:
def update
@painting = Painting.find(params[:id])
if params[:image].present?
preloaded = Cloudinary::PreloadedFile.new(params[:image])
raise "Invalid upload signature" if !preloaded.valid?
@painting.image = preloaded.identifier
end
if @painting.update(painting_params)
redirect_to @painting
else
render 'edit'
end
end
In my view:
<%= cl_image_upload_tag(:image) %>
So once the user edits a painting, they can upload the image which will be stored in the @painting model and then it will be saved. After uploading the image, I check cloudinary and find that no image was uploaded. In addition the @painting model has a nil entry for the :image attribute.
Can't see what I'm doing wrong.