Rails Asset Pipeline - wrong fingerprint

2019-08-30 07:23发布

My Rails 4 application has new.html.erb which has a reference to form.html.erb:

# app/assets/templates/jobs/new.html.erb
...
<ng-include src="'<%= asset_path("jobs/form.html") %>'"></ng-include>
...

# app/assets/templates/jobs/form.html.erb
my form is here

(ng-include is AngularJS directive)

The problem is, that when form.html.erb changes, the production environment still loads the old form.html.erb. This is happening probably because new.html.erb hasn't been changed, and therefore has the same old fingerprint, which points to form.html.erb with the old fingerprint.

What is the Rails way to handle this?

1条回答
Juvenile、少年°
2楼-- · 2019-08-30 07:54

To answer this, in-case anyone else has the issue, you need to run the following:

rake assets:clean
rake assets:precompile
touch tmp/restart.txt

After running the rake task, you need to restart Rack, otherwise the new precompiled assest files will not be loaded.

查看更多
登录 后发表回答