views:

130

answers:

1
f.input :some_model_values, :as => :select

Using Formtastic, I need to set a text for options on my select input, but not populated from :some_model_values.

The second: how could be collection of :some_model_values pre-modefied? Because i don want to show some options according to user role.

Thanks!

+2  A: 

What do You mean with "set a text for option on my select input" ?

Please have a look at the :collection parameter, for example:

f.input :some_model_values, :as => :select, :collection => [1,2,3,4]

or

f.input :some_model_values, :as => :select, :collection => [["male",1], ["female",2], ["other",3]]

When you want to set the label, the best option is to localise it by the /config/locales/#locale#.rb file

Hope this helps

astropanic