{"action":"closed","issue":{"url":"https://api.github.com/repos/dwilkie/carrierwave_direct/issues/76","labels_url":"https://api.github.com/repos/dwilkie/carrierwave_direct/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/dwilkie/carrierwave_direct/issues/76/comments","events_url":"https://api.github.com/repos/dwilkie/carrierwave_direct/issues/76/events","html_url":"https://github.com/dwilkie/carrierwave_direct/issues/76","id":13300151,"number":76,"title":"How does one duplicate a file?","user":{"login":"kikito","id":63131,"avatar_url":"https://avatars.githubusercontent.com/u/63131?v=3","gravatar_id":"","url":"https://api.github.com/users/kikito","html_url":"https://github.com/kikito","followers_url":"https://api.github.com/users/kikito/followers","following_url":"https://api.github.com/users/kikito/following{/other_user}","gists_url":"https://api.github.com/users/kikito/gists{/gist_id}","starred_url":"https://api.github.com/users/kikito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kikito/subscriptions","organizations_url":"https://api.github.com/users/kikito/orgs","repos_url":"https://api.github.com/users/kikito/repos","events_url":"https://api.github.com/users/kikito/events{/privacy}","received_events_url":"https://api.github.com/users/kikito/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-04-17T15:00:33Z","updated_at":"2015-03-09T09:44:07Z","closed_at":"2015-03-09T09:44:07Z","body":"I've got an Avatar class with an AvatarUploader. The carrierwave attribute is Avatar.image. The files are in S3, and have 3 thumbnail versions.\r\n\r\nI need to be able to \"clone\" avatars; this includes creating (or scheduling the creation of) a copy of the files in fog.\r\n\r\nI have tried several variations of the following code, but none worked. Depending on the exact attributes I set, I get validation errors (\"filename already taken\" or \"filename extension is not included on the accepted lists) or nil access errors.\r\n\r\n    class Avatar < ActiveRecord::Base\r\n\r\n    def duplicate(new_owner)\r\n      new_avatar = new_owner.build_avatar\r\n      new_avatar.remote_image_url = self.image_url\r\n      # also tried:\r\n      # new_avatar.remote_image_net_url = self.image_url\r\n      new_avatar.save!\r\n    end\r\n\r\nAny ideas on how to crack this one? I'm starting to guess I will need to make a post to S3 at some point, but I'm unsure of where to do it."}}