2012-03-30 74 views
0

我有一個我正在嘗試部署的rails 3.0.9應用程序。該應用程序在我的開發框(ruby 1.8.7 p352,mongrel)上運行良好,但在生產環境中產生以下錯誤(ruby 1.8.7 p334,Passenger)。Rails 3使用javascript_include_tag生產無錯誤

A ActionView::Template::Error occurred in site#index: 
can't convert nil into String 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:888:in `read' 

堆棧跟蹤是:

vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:888:in `read' 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:888:in `join_asset_file_contents' 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:888:in `collect' 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:888:in `join_asset_file_contents' 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:894:in `write_asset_file_contents' 
vendor/bundle/ruby/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/file/atomic.rb:20:in `atomic_write' 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:894:in `write_asset_file_contents' 
vendor/bundle/ruby/1.8/gems/actionpack-3.0.9/lib/action_view/helpers/asset_tag_helper.rb:356:in `javascript_include_tag' 
app/views/layouts/application.html.erb:79:in `_app_views_layouts_application_html_erb___689799961_85527100_0' 

application.html.erb第79行是:

<%= javascript_include_tag (Rails.env.development? ? "jquery.min.js" : "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"), 
         "jquery-ui.min", 
         "application", :cache => true %> 

我試圖刪除從javascript_include_Tag條件,但不會使任何差異

回答

0

如果所有參數都是a,則只能使用:cache=>true選項重新實際上在您的服務器上的文件 - 軌道不會去,並從你的googleapis獲取jquery(如果有的話,它寧可打敗點)

把jquery.min.js包括在它自己的javascript_include_tag,沒有:cache選項,你應該沒問題。或者,您可以停止嘗試從googleapis加載jquery。

+0

謝謝你做的伎倆,最受讚賞 – user1302719 2012-03-30 09:10:50