I am struggling with the pluralization of the RESTful route generation in Rails 2.3.2.
Specifically, I have a resource called sitestatus
. This resource really is uncountable (deer is deer, not deers). When I specify it as uncountable in an intializer, I get some helpers, but the sitestatuses_path
is unavailable (which would make sense).
So, in a gesture to conformity, I have allowed sitestatus
to be countable. So now, Rails pluralizes sitestatus
to sitestatuses
(not too horrible), but it insists on also singularizing it to sitestatu
(missing the 's', hilarious and horrible at the same time).
So, I whipped out my bigger hammer and added this code to the intializer:
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural "sitestatus", "sitestatuses"
inflect.singular "sitestatus", "sitestatus"
end
(Note: I tried using irregular
and it didn't work right)
Doing this gives me the expected results in the console when I "sitestatus".pluralize
, but when I attempt to make a call to sitestatuses_path
in my view I get
undefined local variable or method 'sitestatuses_path'
When I load up ActionController::UrlHelper in the console and call sitestatus_path(123)
I get sitestatus/123
as I would expect. However, when I call sitestatuses_path
I get
undefined method 'sitestatuses_path' for #<Object...
This name is the name of the model and the controller and it really is the only logical name for both as it lines up with the business name for the object perfectly.
What am I missing?