Rails - Default selected radiobutton in SimpleForm :collection

后端 未结 4 618
一向
一向 2020-12-06 05:22

I\'ve litte problem with radiobuttons in SimpleForm.

When i use

= f.association :manufactureType, :collection => ManufactureType.all, :as => :         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 05:49

    If you pass in the manufacture types into the view, you can do the following:

    :checked => @manufacture_types[0]
    

    Or

    :checked => ManufactureType.first
    

提交回复
热议问题