Newbie Model Question

Hey Folks, Sorry for this newbie question but I am interested on how
you would do the following.

Lets say I have a User model and a User has_one Profile

On the Profile I would like to store basic data ie Gender, Date of
Birth etc.. Then I get to data like yearly income or marital status.

In the past I may have used ENUM's for marital status but would have
used yearly income as a integer for a related table ie, income_id
and then created a Income model to hold possible changing values.

With rails not supporting ENUM's (from what I can work out with
migrations) I was wondering do most of you have allot of related
tables for this sort of thing?

There will be allot of lookups on the user profile so I'm looking for
the best approach.

Hope you can advise!!

Hi!

See if this article can help you:

Best Regards,

Everaldo

P.S: I’m a newbie too, so I can’t find the “better words” to describe the solution. =)

Hey Folks, Sorry for this newbie question but I am interested on how
you would do the following.

Lets say I have a User model and a User has_one Profile

On the Profile I would like to store basic data ie Gender, Date of
Birth etc.. Then I get to data like yearly income or marital status.

In the past I may have used ENUM's for marital status but would have
used yearly income as a integer for a related table ie, income_id
and then created a Income model to hold possible changing values.

For income, where you have a separate table, you want user belongs_to
income and income has_many users. See the Rails Guide on Associations
to see what this does for you. If you have not already done so then
look (in depth) at the other guides also.

I shall be interested on input from others on the best way to handle
the marital status.

I strongly recommend working right through a good tutorial such as the
railstutorial.org (free to use online). Make sure that the guide
matches the version of rails you have (which should probably be
version 3.0). It may appear that the tutorial has little relevance to
your application but you will learn a huge amount about the principles
of Rails even if the sample app itself is not relevant to your needs.

Colin

On the Profile I would like to store basic data ie Gender

Sex. Gender is a term about language being masculine/feminine/neutral.
Sex is male/female.

Except that you're not really interested in finding out whether the user has dangly bits or not (their physical sex); you're interested in finding out their social gender identity is, and 'gender' has been an accepted term for that concept for decades now.

On gender and forms:

http://meloukhia.net/2009/12/beyond_the_binary_forms.html

Chris

On the Profile I would like to store basic data ie Gender

Sex. Gender is a term about language being masculine/feminine/neutral.
Sex is male/female.

Except that you're not really interested in finding out whether the user has dangly bits or not (their physical sex); you're interested in finding out their social gender identity is

*sigh* So how many forms have an option for "gender neutral", or some
other option?

I assert that the existance of the dangly bits (or otherwise) is
*exactly* what the question is trying to determine - mostly the
institutions that are asking this question are trying to put the
answerer into a binary box, they're not *really* interested in what
"gender identity" someone has.

'gender' has been an accepted term for that concept for decades now.

accepted != correct

I recall that in my childhood, it was very accepted to make racist and
sexist jokes on prime-time telly... it doesn't mean that it was a
good, correct or tasteful thing to do. Fortunately, those minority of
people who thought it not appropriate managed to sway the general
opinion.

On gender and forms:
http://meloukhia.net/2009/12/beyond_the_binary_forms.html

yep... if people want to blur their "identity" based on their feelings
about their identity; more power to them. I'm all for their freedom.
As far as I can see, asking for a confirmation of "gender indentity"
is like asking for a sexual preference, and has no place in any census
(other than, maybe, dating site registration forms). Get rid of the
sex boxes all together I say, and make a person's sex irrelevant in
their day-to-day dealings. But while the world wants to know the
orientation of your danglies, the label for the question is "sex" :slight_smile: