Rails - Default selected radiobutton in SimpleForm :collection

后端 未结 4 619
一向
一向 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 06:06

    My example was slightly more complicated, none of the other answers worked for me since there was no collection or model to reference.

    = f.input :attending, as: :radio_buttons, :collection => [ ['Yes', true], ['No', false] ], :checked => ['Yes', true]
    

提交回复
热议问题