Sep 20

ScrubyT traverse_for_match: undefined method each for nil:NilClass

Category: geek out, popular

Using ScrubyT, a Ruby on Rails plugin, on a Linux system such as my CentOS 5 VPS, you can get an error message and stack trace like this:

/usr/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/shared_utils.rb:43:in `traverse_for_match’: undefined method `each’ for nil:NilClass (NoMethodError)

If you see this, go to shared_utils.rb in the path above, and change this block:

node.children.each { |child| traverse_for_m….

into this:

if node.children
node.children.each { |child| traverse_for_m….
end

Thanks to Deginzabi who wrote about it in Japanese. This article is a translation of what he said. Hope this makes the next ScrubyT release! It is a great project.

1 comment

1 Comment so far

  1. J Fishman October 14th, 2009 5:10 pm

    Very useful, thanks. This should be put into the next scrbyt release.

Leave a comment