Quick Tip: Rails Singularization of -ess
Have you ever created a Ruby on Rails application dealing with businesses or addresses? I’d be hard pressed to find someone who hasn’t.
Strangely, though, Rails does not have an inflection that deals with the singularization of these words correctly. From the command line, try singularizing the word “business”:
While this seems like a contrived situation, it’s actually not as hard to hit as you’d think (e.g., common code that needs to singularize the incoming argument). I saw this while using Acl9, a role-based authorization system for Rails…
Here’s a quick fix that you can add to your config/initializers/inflections.rb:
You can read more about how this won’t be fixed in this ticket.
More of my rantings
- Quick Tip: Override Rails Generated URLs
- Rails link_to and HTML options
- Quick Tip: Rails Named Bind Variables
These might also interest you
- Outsourcing Killed By Django And Ruby On Rails (Aware Labs)
- Constructive reasons to use Django instead of Rails (Proxied) (Aware Labs)
- Merb, Rails Myths, Language Popularity and other Zenbits (Antonio Cangiano)