2

I am using Ransack gem in order to create simple search interface. One of the model attributes can be true or false. So, using the Ransack form builder I have the following code:

<div class='radio'>
<%= f.label :is_active_true, 'Is active' %>
<%= f.radio_button :is_active_true, 1, checked: true %>
<%= f.label :is_active_false, 'Is not active' %>
<%= f.radio_button :is_active_false, 1 %>
</div>

The problem is I am not able to "unchecked" the radio buttons, once they are checked.

Is there any optios to make the buttons to work or I should use additional JavaScript?

gotqn
  • 42,737
  • 46
  • 157
  • 243

1 Answers1

2

Like this?

<div class='radio'>
<%= f.label :is_active_true, 'Is active' %>
<%= f.radio_button :is_active_true, 1, checked: true %>
<%= f.label :is_active_true, 'Is not active' %>
<%= f.radio_button :is_active_true, 0 %>
</div>
vissviews
  • 21
  • 2