Rails form_for select tag with option selected

前端 未结 2 407
礼貌的吻别
礼貌的吻别 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:27

    <%= f.select(:status, options_for_select(STATUS, :selected => params[:status])) %>
    

    should be written as

    <%= f.select :status, STATUS %>
    

提交回复
热议问题