I need to save images in this directory
public/images/clients/1/events/2/banner
and I need to save in my database the url of the image
for example:
public/images/clients/1/events/2/banner/example.png
I have this code:
if Dir.exist?(params[:dir_images_banner])
params[:images_banner].each do |image|
File.open(Rails.root.join(params[:dir_images_banner], image.original_filename), 'wb') do |file|
file.write(image.read)
end
end
end
but I wanted to do it with the gem paperclip
How could I do this with the gem paperclip?, I need to save the images in a directory and the url of that directory in my database