There are two things you must do. One of them uses internationalization (I18n) so that your text is saved in your en.yml file, and you can use these labels instead of lines:
# en.yml
en:
no_favorite: 'No favorite'
wine_and_cheese: 'Wine and Cheese'
burger_with_everything: 'Burger with everything'
# You can then translate the labels like this
I18n.t: no_favorite
I18n.t :wine_and_cheese
I18n.t :burger_with_everything
- , . :
OPTIONS = [:no_favorite, :wine_and_cheese, :burger_with_everything]
:
selected_value = 1
I18n.t OPTIONS[selected_value] # => wine_and_cheese
OPTIONS.index :wine_and_cheese # => 1
, (, User # food_preference), :
class User
OPTIONS = [:no_favorite, :wine_and_cheese, :burger_with_everything]
def display_food_preference
I18n.t OPTIONS[food_preference]
end
end