How to insert a null value into DB using a radio_button with form_for

Hi,

I'm trying to add a third option for a filter using a radio button. It's the old null-value-for-a-boolean story. Basically i'd like to add another radio button labelled "No Filter" which would insert a null value into the database when selected. Here is my first attempt. The third button is showing up, but the null value is not being inserted. What am I missing?

<div class="new-partner-form"> <%= form_for [:admin, matching_profile.partner, matching_profile], :html => {:id => "edit_profile", :multipart => true} do |f| %>   <div class="rounded-block semi-wide clear">     <h4>Military Service</h4>     <%= f.radio_button :served_in_us_army, false %>     <%= label :served_in_us_army, 'NO', {:style => 'display:inline'} %>     <%= f.radio_button :served_in_us_army, true %>     <%= label :served_in_us_army, 'YES', {:style => 'display:inline'} %>     <%= f.radio_button :served_in_us_army, nil %>     <%= label :served_in_us_army, 'No Filter', {:style => 'display:inline'} %>     <%= f.error_message_on :served_in_us_army %>   </div>

Hi,

I'm trying to add a third option for a filter using a radio button. It's the old null-value-for-a-boolean story. Basically i'd like to add another radio button labelled "No Filter" which would insert a null value into the database when selected. Here is my first attempt. The third button is showing up, but the null value is not being inserted. What am I missing?

The parameters a rails app gets from a form are always strings, because that's all a form can submit. You'll need to turn the value back into a nil server-side.

Fred