Showing a string to user and saving an integer in the DB

0 views
Skip to first unread message

Alfredo Bonilla

unread,
Jul 26, 2010, 7:07:32 AM7/26/10
to rubyonra...@googlegroups.com
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/.

bungart1978

unread,
Jul 26, 2010, 8:44:40 AM7/26/10
to Ruby on Rails: Talk

Alfredo Bonilla

unread,
Jul 26, 2010, 9:50:34 AM7/26/10
to rubyonra...@googlegroups.com
bungart1978 wrote:
> Hi,
>
> maybe this helps:
> http://guides.rubyonrails.org/form_helpers.html#making-select-boxes-with-ease
>
> Regards
> Marc

Thank 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.

Reply all
Reply to author
Forward
0 new messages