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

Hi,

maybe this helps:

Regards
Marc

bungart1978 wrote:

Hi,

maybe this helps:
Action View Form Helpers — Ruby on Rails Guides

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.