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

**URL:** <https://www.ruby-forum.com/t/showing-a-string-to-user-and-saving-an-integer-in-the-db/192210>\
**Category:** Rails\
**Created:** [July 26, 2010, 1:07pm UTC](https://www.ruby-forum.com/t/showing-a-string-to-user-and-saving-an-integer-in-the-db/192210 "2010-07-26T13:07:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alfa-rero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@alfa-rero](https://www.ruby-forum.com/u/alfa-rero)\
**Post date:** [July 26, 2010, 1:07pm UTC](https://www.ruby-forum.com/t/showing-a-string-to-user-and-saving-an-integer-in-the-db/192210/1 "2010-07-26T13:07:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alfa-rero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@alfa-rero](https://www.ruby-forum.com/u/alfa-rero)\
**Post date:** [July 26, 2010, 2:52pm UTC](https://www.ruby-forum.com/t/showing-a-string-to-user-and-saving-an-integer-in-the-db/192210/2 "2010-07-26T14:52:06Z")

</div>

Hi,

maybe this helps:

> **[Action View Form Helpers — Ruby on Rails Guides](https://guides.rubyonrails.org/form_helpers.html#making-select-boxes-with-ease)**
>
> Action View Form HelpersForms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of the need to handle form control naming and its numerous attributes. Rails...

Regards  
Marc

---

<div class="post-metadata">

**Author:** ![alfa-rero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@alfa-rero](https://www.ruby-forum.com/u/alfa-rero)\
**Post date:** [July 26, 2010, 3:50pm UTC](https://www.ruby-forum.com/t/showing-a-string-to-user-and-saving-an-integer-in-the-db/192210/3 "2010-07-26T15:50:34Z")

</div>

bungart1978 wrote:

> Hi,
> 
> maybe this helps:  
> [Action View Form Helpers — Ruby on Rails Guides](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.
