how to change the value to a name depending on case
Posted
by ZeroSoul13
on Stack Overflow
See other posts from Stack Overflow
or by ZeroSoul13
Published on 2010-04-20T00:35:09Z
Indexed on
2010/04/20
0:43 UTC
Read the original article
Hit count: 245
ruby-on-rails
i've created a select button with 3 option
<%= f.label :prioridad %><br/>
<%= f.select :prioridad, options_for_select([['Alta', 1], ['Medio', 2], ['Baja', 3]]) %>
The value gets inserted to the DataBase but when i display it i see the number op the option selected (which is correct).
What i would like to know is how i can change that so on the index the user can see the name and not the value:
def convertidor
case llamada.prioridad
when prioridad == '1'
puts "Alta"
when prioridad == '2'
puts "Media"
else
puts "Baja"
end
end
This didn't worked. Regars
© Stack Overflow or respective owner