In my ActiveAdmin application, I have a Country
model which has an integer attribute schedule
with limited range of values from 0
to 4
.
In new
and edit
action forms, I would like to select a string from a drop-down box and map it to a corresponding integer value rather than entering the integer value itself directly.
How could I do that using the Formtastic
gem syntax?
See doc about SelectInput here. I think it looks like:
<%= f.input :schedule, :as => :select, :collection => 1..4 %>