Ruby on Rails Saturday, July 31, 2010

On 29 July 2010 17:25, bingo bob <lists@ruby-forum.com> wrote:
> What's the best way of to deal with gender.
>
> i.e. a Person is either Male or Female (generally and fot my purposes
> I'll stick with that rule).

I don't know if it's annoying anyone else, but I've been following
this thread with interest, but every time I read "gender" it grates.
The word you're after is "sex".
"Male" and "female" are sexes. "Masculine", "feminine", "neutral",
etc, are genders...

I appreciate that it seems to have become a convention to use the word
"gender" as a "polite" reference to the discrimination between innies
and outies... but for the vast, overwhelming majority there are only
two choices; either being male or female, and that's your sex (whether
it changes over the duration of your life is a different debate :-)

Now, I'd store that in a text field in the record as either the full
word, or as "m" or "f", and load the DB and the model up with
constraints and validations, and not worry about having a Sex model,
with associated "sexes" table. Move along to other areas of your
application.

Regarding the multiple names issue; in response to the suggestion of
having multiple name midname fields, I'd ask "why?" What's the
ultimate purpose of storing those names? Generally it's to just be
able to
pull them all out of the DB to put on a letterhead when needed, and in
that event, you're optimising too far to give them each a field.

For, again, the vast majority of cases, the following will suffice:
first_name
middle_names
last_name
(although that assumes the WASP model, which the majority of the world
has been forced to adjust it's naming models to, arguably wrongly as
that may have been)

If you want to track whether the name "Michael Pavling" should be
addressed formally as "Mr Pavling" or as "Michael-san", or whatever,
you need to have some way of tracking for each person whether the
first_name or the last_name is the "family" name, or I'd consider a
"salutation" field which stored that value (even though it duplicates
values, breaking normalisation a little).

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment