Rails - Creating a select tag from a object hash

前端 未结 4 2108
无人及你
无人及你 2021-02-18 23:13

I need to create a select box from the values available in a Hash.

For instance, I have a \'thing\' and the \'thing\' has a variety of status fields:

1 =         


        
4条回答
  •  难免孤独
    2021-02-18 23:49

    The select helper method will accept a hash in the form { text_displayed_in_select => select_value }, so you'll probably want to invert that hash.


提交回复
热议问题