Use custom id for check_box_tag in Rails

前端 未结 7 1001
时光说笑
时光说笑 2021-02-04 03:36

How do you set a custom id when using a check_box_tag helper in rails?

I have a loop which creates a bunch of checkboxes based on a collection:

- subject         


        
7条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 03:53

    If you give the check box an extra parameter it will work:

    = check_box_tag 'question[syllabus_reference]', 1, nil, :id => sr.id
    

提交回复
热议问题