Sunday, December 17, 2006

Rails Singularize Fun

A friend of mine is building his first Rails application. He has been having problems with his models. Here is the error:

ArgumentError: ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:399:in `to_constant_name': Anonymous modules have no name to be referenced by


We started chatting about it around 10:30pm. At 1:50am I had an idea:

>> "niche".pluralize
=> "niches"
>> "niches".singularize
=> "nich"


His niches weren't being singularized properly. I checked genres, they work.

>> "genres".singularize
=> "genre"


Rails did not play nice today :-)

1 comment:

Matt McKnight said...

The good news is that this is a great opportunity to submit a patch to the pluralization file.