Dwight Watson's blog

Absolute URL for an ActiveStorage attachment

August 24, 2017

Not sure why, but I couldn’t get url_for to give me an absolute URL with an ActiveStorage attachment, even when playing with all the options available. Turns out that polymorphic_url will give you what you’re after though.

polymorphic_url(@post.header)

A blog about Laravel & Rails by Dwight Watson;
developer of Roomies.com, myRent.co.nz, High School Notes & StudentVIP.com.au.

Follow me on Twitter, or GitHub.