Notes posted by mustai
RSS feed
mustai -
February 14, 2016
1 thank
Text values for enum
There is way to have text values for enum. It is useful to have localized select options and latin values in database. 1) User model: enum kind: { ‘текст’=>‘text’, ‘изображение’=>‘picture’, ‘звук’=>‘audio’, ‘видео’=>‘video’ } 2) Edit view: <%= select_tag ‘user[kind]’, options_for_select(User.kinds, @user.kind) %>