Rails Asset Pipeline - wrong fingerprint

混江龙づ霸主 提交于 2019-12-11 23:58:17

问题


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:


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.



来源:https://stackoverflow.com/questions/17763123/rails-asset-pipeline-wrong-fingerprint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!