Generator error when adding to Subversion
Seems there’s a problem with the Rails generator. I was receiving an odd (pun intended) error:
After a bit of debugging, it turned out that there’s a small problem with the Rails::Generator::Options::ClassMethods#add_general_options! method.
(reformatted for visibility)
This line will return nil, unless the line splits in two (A app/models/test.rb). The problem is that if the number of lines that don’t split in two is odd, then the flattened array will contain an odd number of items, which will cause Hash.new to fail.
The solution ? compact the array before flattening. I already submitted ticket #2814 with a patch.
In the meantime, I’m running a patched copy of Rails.
UPDATE*: revision 2972 applied a modified version of my original patch.
Leave a Reply