昨天我更新了我的rails-app的宝石。 现在,而不是基础5,我正在使用版本6
gem 'foundation-rails'但是自从更新后我每次尝试加载页面时都会收到以下错误:
undefined method `to_h' for nil:NilClass我将错误跟踪到Application.html.erb中的以下代码行
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>如果我删除该行应用程序工作正常(但由于缺少javascript,一些样式等不起作用)。
我真的很无能为什么我得到这个错误,这里的搜索和谷歌也没有任何帮助。 我也试过了
rails g foundation:install没有成功。 我在用
ruby 1.9.3p-194 Rails 4.1.4由于我没有找到任何线索,如果基础6需要更新版本,我不确定错误是否必须对此做些什么。
每个提示都表示赞赏,谢谢! 斯文
Yesterday I updated the gems for my rails-app. Now instead of foundation 5 I'm using version 6 with the
gem 'foundation-rails'But since the update I get the following error everytime I try to load a page:
undefined method `to_h' for nil:NilClassI tracked the error to the following line of Code in my Application.html.erb
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>If I erase that line the app works fine (yet some Styles, etc do not work due to the missing javascript).
I am actually clueless why I get this error and neither the search here nor google could be of any help. I also tried
rails g foundation:installwithout sucess. I am using
ruby 1.9.3p-194 Rails 4.1.4Since I didn't find any clue if foundation 6 needs a newer version I'm not sure whether the error has to do something with that or not.
Every hint is appreciated, Thanks! Sven
最满意答案
更新您的Ruby版本, to_h方法仅适用于Ruby 2.1或更高版本。
我假设在代码中的某处存在如下构造:
=> something_what_actually_can_be_nil.to_h和期望的结果是空哈希(ruby 2.1):
=> nil.to_h #> {}Update your Ruby version, the to_h method is only available in Ruby version 2.1 or higher.
I assume somewhere in the code exists the construction like:
=> something_what_actually_can_be_nil.to_hand expected result is empty hash (ruby 2.1):
=> nil.to_h #> {}更多推荐
发布评论