没有将nil隐式转换为String

mow*_*one 12 css ruby-on-rails stylesheet-link-tag

目前我正在尝试在Ruby on Rails中设置一个简单的应用程序.我已经迁移了db,播种了它,现在我遇到了以下错误.

no implicit conversion of nil into String

Extracted source (around line #4):

1: <!--[if lt IE 9]>
2: <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
3: <![endif]-->
4: <%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
5: <%= stylesheet_link_tag 'blueprint/print',  :media => 'print' %>
6: <%= stylesheet_link_tag 'custom', :media => 'screen' %>
Run Code Online (Sandbox Code Playgroud)

似乎资产标签助手不能正常工作或返回零(如果可能的话)?

mow*_*one 22

我通过将以下行添加到我的application.rb来修复此错误:

ActionController::Base.config.relative_url_root = ''
Run Code Online (Sandbox Code Playgroud)

该错误很可能是由于我的rails版本中的错误是3.0.12.

  • 它是rails版本中的已知错误,它永远不会在Rails 3.0.x中修复,请参阅https://github.com/rails/rails/issues/9619 (5认同)