alexspeller / non-stupid-digest-assets

Fix the Rails 4 asset pipeline to generate non-digest along with digest assets
MIT License
493 stars 87 forks source link

Use the `assets` collection instead of `files` to make sure we get the right version #43

Closed jagthedrummer closed 7 years ago

jagthedrummer commented 7 years ago

Previously we were using the files collection which contains all versions of all digest assets sorted chonologically. This meant that if an asset was reverted to a previous state (by git revert for instance) then the non-digest version of the asset would end up being the wrong version. See #42 for additional details on the problem.

By iterating over the assets hash instead of files we make sure that we're using the digest versions that the app considers to be "current". A nice side effect is that we also end up copying fewer files.

Fixes #42

alexspeller commented 7 years ago

Awesome, thanks!

jagthedrummer commented 7 years ago

My pleasure. Thanks for the useful gem, @alexspeller!

alexspeller commented 7 years ago

Released version 1.0.9 with these changes in