Tinymce-rails-imageupload

Hi. I have a beginner level. And I can not get the image url (i do not
know how).

Create
name = params[:file].original_filename
directory = “public/data”
#create the file path
path = File.join(directory, name)
#write the file
File.open(path, “wb”) { |f| f.write(params[:file].read) }
Render
image: {
url: view_context.image_url(image)
}
File is saved, but I do not know how to get the url …
thanks for the help.