Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recreate_versions! using the unique filename method stated in the wiki

I'm trying to use the method recreate_versions! but I'm using the method from the wiki to create unique filenames. The problem is that when I run recreate_versions! it changes the filenames but it doesn't update them on the mounted object itself. How could I refresh these URL's?

like image 592
Yeggeps Avatar asked Dec 10 '22 04:12

Yeggeps


1 Answers

A solution that works when dealing with caching is to save the mounted object after recreating versions:

Example:

avatar.image.recreate_versions!
avatar.save!

This way you can keep using unique filenames even when recreating versions and properly handle caching.

like image 191
Sébastien Grosjean - ZenCocoon Avatar answered Jan 11 '23 23:01

Sébastien Grosjean - ZenCocoon