Rails form_for select tag with option selected

前端 未结 2 406
礼貌的吻别
礼貌的吻别 2021-02-05 14:04

I am using a form_for to update a user profile.

As part of the form I am using a select menu. The menu is filled from an array ie,

STATUS = [[\'Active\',         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 14:38

    In the case that params doesn't do it for you, try

    <%= f.select(:status, options_for_select(STATUS, :selected => f.object.status)) %>
    

提交回复
热议问题