Duplicate a rails object with associations and paperclip attachments -
I have paperclip-attachments in anything related objects from an object with several organizations which are stored on S3. .
copy_salon = @ salon.dup copy_salon: If I object copy and associations it works fine but not attachments duplicate It works without getting images here .about_us_versions = @ salon.about_us_versions.collect {| About | about_us.dup}
I tried to link this kind of image:
copy_salon = @ salon.dup copy_salon.about_us_versions = @ salon.about_us_versions . Gathered {| About_us | About_us_dup = about_us.dup that about about_us.about_us_image about then_us_dup.about_us_image = about_us.about_us_image end about if about_us.team_image then_us_dup.team_image = about_us.team_image about_us_dup} But then I'm getting the error 'can not be converted into zero in string', probably because not all images are installed.
not understood, elegant but not working I hope SW all associations and attachments to my objects Will duplicate with There is no gem for that
copy_salon = @ salon.dup copy_salon.about_us_versions = @ salon.about_us_versions.collect {|? About_us | About_us_dup = about_us.dup until about_us.about_us_image.url == "/about_us_images/original/missing.png" about_us_dup.about_us_image = about_us.about_us_image end until about_us.team_image.url == "/ team_images / original / missing Png "then about_us_dup.team_image = about_us.team_image end about_us_dup}
Comments
Post a Comment