2012-03-30 55 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