title: how to change the name of image in model file in paperclip before saving in rails?
body: <p>I am using paperclip to save images in s3. The following is the code in my model </p>
  
  <pre><code>has_attached_file :pic, :storage =&gt; :s3, :s3_credentials =&gt; "#{Rails.root}/config/s3.yml",
      :url =&gt; '/image/file/:basename.:extension',
      :path =&gt; '/image/file/:basename.:extension',
      :bucket =&gt; 'Test'
  </code></pre>
  
  <p>And the problem is whenever i save the image with same name, the image gets replaced if there is already an image with that name. I wanted to change the name of the file. I am saving the image during the creation of new item. So can i able to use the id of the item as name of the file so that the image will be unique? If yes then how can i do it? please help me.</p>