rails check_box_tag set checked with default value

后端 未结 6 1397
说谎
说谎 2021-02-18 14:38

I currently have a rails check_box_tag call that looks like

check_box_tag #{name}

I want to include a checked attribute, which I know I can do

6条回答
  •  终归单人心
    2021-02-18 14:59

    If you want the checkbox to be checked, then

    check_box_tag name, value, {:checked => "checked"} 
    

    otherwise

    check_box_tag name, value
    

提交回复
热议问题