Rails 3 - checkbox for create (opposite of _destroy)

前端 未结 1 546
一整个雨季
一整个雨季 2021-02-09 23:26

I have a Query model with a has_many relationship to OutputFields. In my query controller\'s new function I build several OutputFields within the query instance. In my form, I w

1条回答
  •  时光说笑
    2021-02-09 23:54

    By default the value of the check_box form helper is to set the checked_value to '1' and the unchecked_value to '0'. So to reverse the behaviour of the destroy checkbox, just switch these values around.

    <%= builder.check_box :_destroy, {}, '0', '1' %>
    

    0 讨论(0)
提交回复
热议问题