What would be a good way to store profile-information, in the cases where the information can be selected from a list of choices? i.e. gender (male,female), religion or marital status. The lists don''t change, so putting that in the db doesn''t seem like a good idea, but how do i put something like this in a model? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you''re asking how to store the options for the user to choose from, you ought to just put them in your view. If you''re asking how to store the user''s selections, they ought to go in your database. If you''re asking something else then I didn''t understand your question :) On Jan 29, 7:58 am, Peter <peterdun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What would be a good way to store profile-information, in the cases > where the information can be selected from a list of choices? i.e. > gender (male,female), religion or marital status. > > The lists don''t change, so putting that in the db doesn''t seem like a > good idea, but how do i put something like this in a model?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i meant a good way to store the selections in the database,for example should i store someone''s marital status just as a string, using... validates_inclusion_of :marital_status, :in => %w(single married) ...or would it be better to just use a number, and if so: how would i map those numbers in a handy way in my model (constants?) so i can use just the corresponding options (1=single,2=married,etc) elsewhere in a nice way. On Jan 29, 4:48 pm, Matt White <whit...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you''re asking how to store the options for the user to choose from, > you ought to just put them in your view. If you''re asking how to store > the user''s selections, they ought to go in your database. If you''re > asking something else then I didn''t understand your question :) > > On Jan 29, 7:58 am, Peter <peterdun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > What would be a good way to store profile-information, in the cases > > where the information can be selected from a list of choices? i.e. > > gender (male,female), religion or marital status. > > > The lists don''t change, so putting that in the db doesn''t seem like a > > good idea, but how do i put something like this in a model?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---