Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Singularize edge case where it doesn't return to the correct singular #566
It appears that singularize does't always return a plural to the correct singular.
While creating an app with the generator where the controller was called 'AreasOfAnalysis' it is correctly pluralized as 'AreasOfAnalyses', however I noticed that the generator had singularized variables as 'areas_of_analyasis'.
It worked fine, my model was called AreasOfAnalysis everything worked fine until I integrated the using library cancan to provide authorization, it appears to rely on singularize to recover the model name from the controller name.
Which results in the incorrect singular. As a result throws an 500 error for a missing constant. After tracking this down I noticed this could be down to the singularization of the controller name.
A quick test on the rails console confirmed, this is just pluralize and back
This was to mimic the controller naming
This is in tested in Rails 3.0.7, also seems to affect earlier releases, tested with 2.3.5, 2.3.4 and 3.0.3