title: Duplicating a record with a Paperclip attachment
body: <p>I'm creating an action which duplicates an item and then allows the user to edit it and save it back to the database.</p>
  
  <p>I've written the following method in my controller and it mostly works apart from the Paperclip attachment which won't move across for some reason.</p>
  
  <pre><code>def duplicate
    existing_event = Event.find(params[:id])
    @event = Event.new(existing_event.attributes)
  
    render action: 'new'
  end
  </code></pre>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/11443148/duplicate-a-rails-object-with-associations-and-paperclip-attachments">this question</a> where the person is using <code>.dup</code> but I can't seem to get that working in a situation where the user edits the new item before saving.</p>
  
  <p>I also tried using something like <code>@event.image = existing_event.image</code> but that didn't have any effect either.</p>
  
  <p>This is what my create method looks like:</p>
  
  <pre><code>def create
    @event = Event.create(event_params)
  
    if @event.save
      redirect_to events_path, notice: "Event was successfully created."
    else
      render action: 'new'
    end
  end
  </code></pre>
  
  <p>If it makes any difference I'm using S3 for the image uploads too and it doesn't really matter to me if there are multiple copies of the image up there.</p>
  
  <p>Can anyone help? Thanks!</p>