Today I upgraded to Ruby on Rails version 0.14.2, while working on a new website when I went to generate a scaffold I started getting the following error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?

After searching around for a little bit I found out that it was a problem in the latest code. Basically you have to change the line 49 in scaffold_generator.rb which gem usually installs at /usr/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/rails_generator/generators/components/scaffold/ from

1
@controller_name = args.shift or (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name)

to

1
@controller_name = (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name)

Credit for this fix goes to ‘anymouse’ who posted the fix at Stephen’s Web

Back to blog...