1

私はHerokuの初心者です。この Rails アプリケーションをローカルで実行すると正常に動作し、heroku にデプロイすると壊れます。画像をご覧ください。その画像内に矢印を向けました。


ここではローカルで正常に動作し、このように動作すると思われます。 ここに画像の説明を入力


CSS はここで画像を壊しますが、このようなことは想定されていません。Heroku サーバーでのみ発生します。 ここに画像の説明を入力


Railsアプリケーション内に複数のCSSファイルがあり、そのうち約9つです。
Ruby 1.9.3でRails 3.2を使用しています

私はこの問題を解決しようとしてきましたが、どこでもこの解決策を探しましたが、うまくいきませんでした。以前は問題なく動作していましたが、どのように発生するのかわかりません。

助けていただければ幸いです。解決された場合は、答えを正しいものとしてマークします。

ありがとう!

更新: 私が git push heroku を実行したとき、これが私が見たものです:

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_9a6529a8-57cd-4fb0-9cc0-39ebfcdb2c7a/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_9a6529a8-57cd-4fb0-9cc0-39ebfcdb2c7a/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_9a6529a8-57cd-4fb0-9cc0-39ebfcdb2c7a/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_9a6529a8-57cd-4fb0-9cc0-39ebfcdb2c7a/Rakefile:7)
       Asset precompilation completed (105.95s)

application.css の中を見ると、

/*
*= require_self
*= require_tree .
*/

/* rest of file omitted */
4

1 に答える 1

2

おそらくアセット パイプラインに関連しています。

すべてのアセットが application.css で必要とされているか、またはに追加されていることを確認してください

config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']

application.rbで。

アセットは実行時にローカルでコンパイルされますが、本番環境ではコンパイルされません。

編集: active_admin が適切に機能するようにするには、application.css に含めないでください。つまり、

require_tree .

各ファイル/ディレクトリを個別に必要とします。

于 2013-10-04T17:32:16.653 に答える