Skip to content

Adding gender-specific messages to your rails app with genderize

Gavin Morrice

Written by Gavin Morrice on May 6th, 2013 11:01

Type caption for image (optional)

Often in an application, you'll want to display a clear, readable message back to the user about another user. e.g. "Sarah is a new member, why not send her a message?" 

App developers often fall back on using gender-neutral pronouns because this saves them the trouble of having to write each message twice, once for each gender. So the above example is would be more commonly written as: "Sarah is a new member, why not send them a message?" In terms of creating a rich, and comfortable user experience, this solution isn't optimal, but it's understandable why so many applications do it—it saves time and effort (read "money").

I encountered this issue on a client application we're working on at the moment and decided to take a little time to write a reusable solution which would allow us to enhance the user-experience, while not adding too much time and code to the project. The solution is genderize, a really simple Rails gem that makes your Rails models gender—aware. It provides a bunch of helpful methods for gender-specific pronouns and abbreviations. 

The gem is available on Github and can be installed via Rubygems

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more