I have an api endpoint on rails which is responsible for uploading an image.
def upload_user_photo if current_user == @user @user.avatar.purge