资产预编制后的网页丢失了所有设计

时间:2014-10-10 17:28:38

标签: ruby-on-rails ruby

最近我将我的应用环境更改为Production。之后我在日志文件中收到错误消息。

ActionView::Template::Error (jquery.fancybox.pack.js isn't precompiled):

所以我尝试执行rake assets:precompile,但没有任何反应。错误保持不变。 在Stack Overflow中,我找到了将此代码添加到 production.rb

的消息
  config.assets.precompile << Proc.new { |path|
  if path =~ /\.(css|js)\z/
    full_path = Rails.application.assets.resolve(path).to_path
    app_assets_path = Rails.root.join('app', 'assets').to_path
    if full_path.starts_with? app_assets_path
      puts "including asset: " + full_path
      true
    else
      puts "excluding asset: " + full_path
      false
    end
  else
    false
  end
}

然后我耙资产:再次预编译。现在我做了一些动作,如:

including asset: /home3/ecotec11/rails_apps/technorent/app/assets/javascripts/active_admin.js
including asset: /home3/ecotec11/rails_apps/technorent/app/assets/javascripts/ga.js
including asset: /home3/ecotec11/rails_apps/technorent/app/assets/javascripts/jquery-1.9.1.min.js

...

excluding asset: /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/tinymce-rails-3.5.9/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css
excluding asset: /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/tinymce-rails-3.5.9/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/content.css

现在我正在浏览我的网络应用程序,但所有风格和设计都消失了......

什么可能导致这个问题? 谢谢!

2 个答案:

答案 0 :(得分:0)

如果你使用bootstrap,尝试通过rake tmp:clear清除temp。需要有关您的宝石的更多信息,并记录。

答案 1 :(得分:0)

喔。我在谷歌做了不好的研究。 发现我的日志文件显示路由错误:

ActionController::RoutingError (No route matches [GET] "/assets/4_600_350-764568941999af034523c215c97b086f.jpg"):

发现我需要在production.rb文件中设置

  config.serve_static_assets = true