Avoid assets disappearing on you

My problem is fairly simple, and I am more than 100% sure more people
have
issues with it.

First of all, let’s be clear, I am not quite “new” to rails, I have been
working steadily with it for over a year (And I love it), and I do a lot
of
more advanced stuff, so I am not unfamiliar with the asset pipeline at
all.

But one of the things that I always get back to is the assets pipeline,
and
using it for more “permanent” assets like logos.

The Asset Pipeline is amazing and I’m all for opinionated solutions, but
I’m all for solutions, and the decision to not use querystrings, albeit
respectable in the sense it leverages proxies, creates a problem where
mails sent today may appear without a logo in the near future.

I am not saying this should change (unless all or at least most caching
proxies started picking up query strings, if that’s the case maybe
changing
is a good idea). I’m just looking for a solution to serve (At least some
of) the assets that were deleted by using the newest version, even with
different digests. I had to upload files to the public folder more than
a
few times, and I feel like it’s an awful way to fix it.

Now, having estabilished I do understand the Rails way and I am only
trying
to devise a way to keep serving files, what is the general opinion about
it, and are there already ways to achieve it?

Thanks, and nice to “meet” you all. :smiley:

On Tuesday, December 15, 2015 at 6:57:36 AM UTC, Fernando Cordeiro
wrote:

The Asset Pipeline is amazing and I’m all for opinionated solutions, but I’m all
for solutions, and the decision to not use querystrings, albeit respectable in the
sense it leverages proxies, creates a problem where mails sent today may appear
without a logo in the near future.

I am not saying this should change (unless all or at least most caching proxies
started picking up query strings, if that’s the case maybe changing is a good
idea). I’m just looking for a solution to serve (At least some of) the assets that
were deleted by using the newest version, even with different digests. I had to
upload files to the public folder more than a few times, and I feel like it’s an
awful way to fix it.

The standard way to solve this (if serving the assets directly) is to
symlink public/assets to a folder that persists across deploys - this
way old assets remain available. If you use Capistrano to deploy your
apps this is done with you (and they also provide a rake task for
deleting assets that haven’t been deployed in over a certain
(configurable) time.

Fred

On 15 December 2015 at 08:12, Frederick C.
[email protected] wrote:

On Tuesday, December 15, 2015 at 6:57:36 AM UTC, Fernando Cordeiro wrote:

The Asset Pipeline is amazing and I’m all for opinionated solutions, but I’m
all for solutions, and the decision to not use querystrings, albeit respectable in
the sense it leverages proxies, creates a problem where mails sent today may
appear without a logo in the near future.

I am not saying this should change (unless all or at least most caching proxies
started picking up query strings, if that’s the case maybe changing is a good
idea). I’m just looking for a solution to serve (At least some of) the assets that
were deleted by using the newest version, even with different digests. I had to
upload files to the public folder more than a few times, and I feel like it’s an
awful way to fix it.

The standard way to solve this (if serving the assets directly) is to symlink
public/assets to a folder that persists across deploys - this way old assets
remain available. If you use Capistrano to deploy your apps this is done with you
(and they also provide a rake task for deleting assets that haven’t been deployed
in over a certain (configurable) time.

An even better solution to your problem with emails is not to embed
linked images in emails. Many, many people have image download
disabled in their email viewer (possibly gmail defaults to this mode,
not sure). Also the images are not available when viewing email
offline.

Colin

This takes away from the OPs original request. I’ve not heard that most
people have image download turned off but ok.

I think the best option is to symlink public/assets across a persisted
directory as the other gent said. This is how I do it and it works
pretty well.

Sent from my iPhone

On Tue, Dec 15, 2015, at 22:13, [email protected] wrote:

This takes away from the OPs original request. I’ve not heard that most
people have image download turned off but ok.

quite sure it’s off by default in many clients. I personally almost
never turn on (remote) images on email.

I think the best option is to symlink public/assets across a persisted
directory as the other gent said. This is how I do it and it works pretty
well.

The other alternative is to inline the images using attachments.inline
(and this way the images will usually be shown because it’s not a local
resource).