我是 rails 和 heroku 的新手,希望有人可以帮助我解决我遇到的问题。我有一个雪松堆栈。当我推送它时,我将 config.assets.initialize_on_precompile = false 添加到我的 application.rb 文件中“运行:rake assets:precompile”。但是,我没有看到任何提及我的 jquery-ui-1.8.18custom.css 文件。当我运行 heroku logs 时,它抱怨这个文件没有预编译。我错过了什么吗?当我尝试在本地进行预编译时,它只是挂起,但据我所知,无论如何我都不应该在本地进行,最好不要这样做。
有什么建议么?
这是我对heroku的推动的结束:
Running: rake assets:precompile
/usr/local/bin/ruby /tmp/build_3gao4dm3wwned/vendor/bundle/ruby/1.9.1/bin
/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size is 16.2MB
-----> Launching... done, v82
http://MYAPPNAME.herokuapp.com deployed to Heroku
这是我的错误日志:
2012-03-14T15:40:29+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2012-03-14T15:40:29+00:00 app[web.1]: Rendered homes/index.html.erb within layou
ts/application (0.4ms)
2012-03-14T15:40:29+00:00 app[web.1]: 2: <html>
2012-03-14T15:40:29+00:00 app[web.1]:
2012-03-14T15:40:29+00:00 app[web.1]: ActionView::Template::Error (jquery-ui-1.8
.18.custom isn't precompiled):
更新:
我将 config.assets.compile = true 添加到 production.rb ,这似乎解决了问题。这有什么问题吗?
作为替代方案,我尝试将其添加到 application.rb 中: onfig.assets.precompile += %w( *.js *.css ) 然后运行 rake precompile ,但我仍然收到错误。