I want migrate my images from one model to another. My old model looks like:
class Post < ActiveRecord::Base
has_attached_file :logo,
url: '/test/post/logo',
path: ':rails_root/uploads/test/post/:id/logo/:hash',
hash_secret: 'secret',
styles: { thumb: ['200x150>', :jpg], medium: ['320x240>', :jpg], large: ['480x360>', :jpg] }
end
the new model looks like the old one.
Currently i try to migrate the images with the following code snippet:
new_logo = post.logo
new_image.logo = new_logo
new_image.save
But unfortunately is doesn't work. I get the following error:
No such file or directory @ rb_sysopen - /abcde/fghjk/test/post/1/logo/43023e427c1deb69789bbf7b75cf32810fbb6354
When i search for the hash in the directory, it doesn't match some of the hashes.
Without hashing it will work like a charme but i need a solution with hashed attachments.
Have someone an idea to solve my problem?