class ActiveSupport::Inflector::Inflections

def irregular(singular, plural)

irregular 'person', 'people'
irregular 'cactus', 'cacti'

plural form.
regular expressions. You simply pass the irregular in singular and
singularization at the same time. This can only be used for strings, not
Specifies a new irregular that applies to both pluralization and
def irregular(singular, plural)
  @uncountables.delete(singular)
  @uncountables.delete(plural)
  s0 = singular[0]
  srest = singular[1..-1]
  p0 = plural[0]
  prest = plural[1..-1]
  if s0.upcase == p0.upcase
    plural(/(#{s0})#{srest}$/i, '\1' + prest)
    plural(/(#{p0})#{prest}$/i, '\1' + prest)
    singular(/(#{s0})#{srest}$/i, '\1' + srest)
    singular(/(#{p0})#{prest}$/i, '\1' + srest)
  else
    plural(/#{s0.upcase}(?i)#{srest}$/,   p0.upcase   + prest)
    plural(/#{s0.downcase}(?i)#{srest}$/, p0.downcase + prest)
    plural(/#{p0.upcase}(?i)#{prest}$/,   p0.upcase   + prest)
    plural(/#{p0.downcase}(?i)#{prest}$/, p0.downcase + prest)
    singular(/#{s0.upcase}(?i)#{srest}$/,   s0.upcase   + srest)
    singular(/#{s0.downcase}(?i)#{srest}$/, s0.downcase + srest)
    singular(/#{p0.upcase}(?i)#{prest}$/,   s0.upcase   + srest)
    singular(/#{p0.downcase}(?i)#{prest}$/, s0.downcase + srest)
  end
end