小编Yig*_*vci的帖子

Heroku为Rails 5应用程序提供旧资产

我在Heroku上部署了一个新版本的Rails 5应用程序,运行在cedar-14堆栈上.它在部署时没有预编译,所以我heroku run rake assets:precompile手动完成.不过,我可以看到它包含旧资产,同时需要cssjs文件.

我的文件都在,app/assets所以目录不可能不在资源编译路径中.

我的配置application.rbproduction.rb:

config.assets.compile = true

# I checked the environment variable, it responds to 'enabled',
# which would return true for the option.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Which I changed to expire old assets.
config.assets.version='1.1'
Run Code Online (Sandbox Code Playgroud)

我尝试过这些,但它们不起作用:

  • $ heroku restart
  • $ heroku run rake assets:precompile
  • $ heroku run rake assets:clobber

这些奇怪的是它们不会影响我检查过的heroku服务器中的资产$ heroku run ls public/assets.即便如此$ rake assets:precompile,即使这样说:

WRITING /app/public/assets/application-{VERY_LONG_HASH}.js
WRITING …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku ruby-on-rails-5

6
推荐指数
1
解决办法
1366
查看次数

标签 统计

heroku ×1

ruby ×1

ruby-on-rails ×1

ruby-on-rails-5 ×1