1

私はレールとヘロクが初めてで、誰かが私が抱えている問題で私を助けてくれることを望んでいました. 私は杉の山を持っています。config.assets.initialize_on_precompile = false を application.rb ファイルに追加しました。ただし、特に jquery-ui-1.8.18custom.css ファイルについての言及はありません。heroku ログを実行すると、このファイルがプリコンパイルされていないというエラーが表示されます。何か不足していますか?ローカルでプリコンパイルしようとするとハングするだけですが、私の理解では、とにかくローカルで行う必要はなく、そうしないのが最善です。

助言がありますか?

これが私の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):

アップデート:

production.rb に config.assets.compile = true を追加したところ、問題が解決したようです。これに問題はありますか?

別の方法として、代わりにこれを application.rb に追加しようとしました: onfig.assets.precompile += %w( *.js *.css ) そして rake precompile を実行しましたが、まだエラーが発生していました。

4

1 に答える 1

1

これは2つのことかもしれません。ビューからアセットに直接リンクしようとしている場合は、プリコンパイルするようにアセットを設定する必要があります。

http://neilmiddleton.com/precompiling-non-default-assets-with-rails-3/

ただし、それがツリー内にあり、含まれることを期待しているapplication.css場合は、マニフェストに直接含まれていること、または含まれているツリーの1つに含まれていることを確認する必要があります。

たとえば(application.css):

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new file per style scope.
 *= require_self
 *= require "reset"
 *= require "base"
 *= require "jquery-ui-1.8.18.custom"
*/
于 2012-03-14T18:05:17.920 に答える