Quick Tip: Rails Singularization of -ess

How to handle singularization of words like 'business' and 'address' through custom inflection rules in Ruby on Rails.

Posted by Curtis Miller Curtis Miller

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.

Velocity Labs

Need web application development, maintenance for your existing app, or a third party code review?

Velocity Labs can help.

Hire us!