Pretty location not working with download endpoint

Hi! I’m sure I’m missing something stupid…

In my uploader class I have this:

class ImageUploader < Shrine
plugin :pretty_location
plugin :download_endpoint, prefix: "images", host: "https://#{Settings.asset_host}"

Then I use the .download_url method to get the image URL including the CDN host. The download URL looks like this though:

I would like to have a URL like<identifier>/filename.extension

The pretty_location plugin doesn’t seem to be working at all.

What am I missing?


I am trying with the generate_location method as well but the record id (identifier) is still nil at that stage because the record is not persisted yet. Is this why the plugin isn’t working properly?

I’m stupid :smiley:

If I try “Save As” the filename is correct. Nevermind :smiley:

How did you solve this issue?

I also want to return my path as:<identifier>/filename.extension

However, when I try: user.image_url
I got the unique identifier


Hi, try with download_url - you need to configure the download endpoint.

1 Like