Alfredo Bonilla
2010-Jul-26 11:07 UTC
Showing a string to user and saving an integer in the DB
Hi, I would like to know the best practice for following situation: * For saving DB space, instead of saving a list of string values ("Implemented", "Non Implemented", "Partially Implemented"), I want to save an integer value (1, ,2, 3) * My doubt is how to manage this situation in terms of:> * Show list of values (strings)in a combo > * Assign selected value to the integer field in the DB > * Validate value* ActiveRecord has any kind of functionality for this? * Do I use helpers for translating? If this is the solution... how do I do this? Thx in advance -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
bungart1978
2010-Jul-26 12:44 UTC
Re: Showing a string to user and saving an integer in the DB
Hi, maybe this helps: http://guides.rubyonrails.org/form_helpers.html#making-select-boxes-with-ease Regards Marc On 26 Jul., 13:07, Alfredo Bonilla <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I would like to know the best practice for following situation: > > * For saving DB space, instead of saving a list of string values > ("Implemented", "Non Implemented", "Partially Implemented"), I want to > save an integer value (1, ,2, 3) > > * My doubt is how to manage this situation in terms of: > > > * Show list of values (strings)in a combo > > * Assign selected value to the integer field in the DB > > * Validate value > > * ActiveRecord has any kind of functionality for this? > * Do I use helpers for translating? If this is the solution... how do I > do this? > > Thx in advance > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Alfredo Bonilla
2010-Jul-26 13:50 UTC
Re: Showing a string to user and saving an integer in the DB
bungart1978 wrote:> Hi, > > maybe this helps: > http://guides.rubyonrails.org/form_helpers.html#making-select-boxes-with-ease > > Regards > MarcThank you very much. It is was I was searching for. I use select_tag for entering the info (combos) and later a helper translation for showing the stored value. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.