title: Upload images to directory with paperclip - Ruby on rails
body: <p>I need to save images in this directory</p>
  
  <pre><code>public/images/clients/1/events/2/banner
  </code></pre>
  
  <p>and I need to save in my database the url of the image</p>
  
  <p>for example:</p>
  
  <pre><code>public/images/clients/1/events/2/banner/example.png
  </code></pre>
  
  <p>I have this code:</p>
  
  <pre><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
  </code></pre>
  
  <p>but I wanted to do it with the gem <code>paperclip</code></p>
  
  <p>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</p>